문제

I have one UITextField and it's referencing outlet name title. when i use title as a outlet it crashes my application. and gives error [UITextField isEqualToString] NSInvalidArgument etc.

and when I use titles it work fine. I search more in google for reserved words in ios and there i not found that title is a reserved word. so please anybody knows about this simple issue than please share it with me. I know this is simple issue but I'm new in ios development and right now I'm trainee developer so for me this is a big issue because I want to know why this title word as a referencing outlet not working.

Thank You!

도움이 되었습니까?

해결책

Assuming you are doing this on a class that extends UIViewController, the problem is that UIViewController already has a property named title with a type of NSString.

By adding an outlet for a UITextField with a name of title, you are creating a conflict with the NSString property named title.

Simply give your outlet a name that doesn't conflict with an existing property name.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top