How do I know what UITextField the code is referring to? - objective-c

I have about 9 UITextFields in my XIB. In my code, when I will use the text fields, how will I know which text field my code is referring to. (This is important because I need to save it to a specific variable. I am using Xcode, if it helps. Should I put some identifier on the text field? Please help.

I got the answer. I had to poke around on the web and I found a site where it told me to control+drag to the .h file under the #interface, and then control+drag element to the files owner. If anyone wants the link it is here. It is for iOS but it works the same for mac (I hope.)

Related

Swift/ObjC: IBOutlets shown as `not bound` from Interface Builder

Ever since Xcode 6, when you bind objects from a Storyboard/xib file to a variable in your class, they often show not bound in the class.
So, finding the corresponding Storyboard/xib file then is more slow, as you have to manually go, and open the corresponding file (assuming you know exactly where that view controller lives among all Storyboard/xib file in your code).
There's seems to be no workaround out there.
Has anyone found the same issue? And along with this, has anyone found a workaround?
There are many disappointing bugs in Xcode, and this one of them. After you navigate to Storyboard containing these outlets, Xcode eventually find these bindings and will show them appropriately.

xcode 8.1 xib editing hang, text editor workaround?

So, since updating, the gui randomly hangs editing a xib file. The scenario goes like this:
click an object - i.e, array controller
expand a parameter, Filter Predicate here
Select target object in pull down
try to enter model key path - HANG
In different xib files, the hang comes when trying to enter the model key path textfield. I've also seen errors citing bogus fields like 'Hidden3' for some attribute bindings - only workaround was to remove them.
Has anyone ventured to editing the xml directly, but I guess I can do that in code :-(
Well, I know this is an old question, but I found an answer.
My situation was similar to the one described above: Xcode hanging whenever I edited the key path of any binding in Xcode 8.1. Nothing described here or elsewhere worked.
However, what did work was to edit the storyboard outside of the actual Xcode project: open the offending StoryBoard by itself, do not access it through the project.
This appears consistent with a Sample/Spindump through the Activity Monitor when Xcode hung that showed functions that appeared related to auto-completion/edition. Unchecking auto-completion did not work though (in Prefs).

Adding comments to xib file

I am working on xib file that has many objects, which hide each other and also change in code.
I would to make my work, and any other future programmer easier by adding comments in the xib file.
I thought of just putting some text area outside the view I'm using, but I want to make sure I'm not effecting the final executable.
Is this a valid way to do it?
1./ In interface-builder, select the object to comment, open the inspector:
in the last tab (with the (i) icon, at the bottom of the inspector panel, you'll see a note area: write your comments there. You may want to click on "show with the selection".
2./ comment in code any object that should change programmatically

rename xib file

I started to create an app using tabbar app template provided in xcode. Then I wanted to change the names of the files: FirstViewController should become YellowViewControler and FirstView.xib should become YellowViewcontroller.xib. Changing the name of the xib wasn't done right. It became red as if it didn't exist in the project. So: how should I change the name of the xib files?
Use the "Refactor" tool of Xcode.
This will manage the renaming of the XIB file, the renaming of the interface & implementation of the source file containing the definition of the ViewController, the renaming of your class declarations/definitions, and any references that are used anywhere in your projects, all of this in one action.
Rename the stuff back to what their original name was (FirstViewController) and then go to the interface file for it (.h) and right click on the class name (FirstViewController) and click refactor. This should make sure everything gets changed correctly.
Source this question
Most likely your viewcontroller name still linked to previous owner therefore open the viewcontroller.xib in source code and find the owner and changed to current name. It will fix the problem right away.

how to unlock rootviewcontroller header file in iphone

Hi Acidentally locked my rootviewcontroller.h file in my application, so if i write some code
in that file it shows "Not Writable RootViewController.h", i am a beginer so please help me how to unlock that .h file.
thanks in advance
You can lock/unlock file easily by using the lock button (see below) in the text editor's navigation bar. See the XCode Workspace Guide for details.
alt text http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/XcodeWorkspace/art/navigation_bar.jpg
solution, thats small mistake,
heres a solution, this may help some beginer like me,
if u need to protect your file from editing, you can select that file , and click the lock icon, that will be appear above split window icon, in xcode,(right edge). so that u cannot make changes on that file, if u need to unlock, just click once again.
thats it,