In some web articles in the past I see an option in Xcode to add a new file using a "UITableViewCell subclass" template. For example here.
I can't see this in Xcode myself (I have the latest version, v4 of xcode).
Anyone know anything about this?
Choose Objective-C class
Press Next
Select UITableViewCell from the dropdown menu
It is a bit weird but it is.
You want to add an Objective C class (Under Cocoa Touch), then you'll be presented with a "Subclass of..." dialog. Select UITableViewCell.
Related
This is what I'm talking about, only just hiding half of the view that called it:
I've searched on the internet for hours, but I seem to be missing some sort of key word. I've searched: iOS Menu, iOS Overlay Menu, iOS Options Menu, iOS Sharing Menu (as it resembled the old one), iOS Called Menu and variations of all of those. It would be extremely helpful if someone could tell me the name of this type of menu or possible explain how to make one.
That's called a UIActionSheet.
I am using XCode 4.3 and I am creating a tab bar application following an example in my book (likely used for XCode version < 4.3) but when I add a new tab and turn on check-mark to generate XIB file while adding a new file of Cocoa Touch, the GUI doesn't appear but display instead its generated XML file content. Do you know how to fix this ?
I find each time there is a new version of XCode, the Gui and defined functions seem to change a lot, doesn't this annoy for low programmers like me ? (By low, I mean newbies and those who can't keep up with such rapid changes). Thank you.
You can view my shot here
http://imageshack.us/photo/my-images/685/appleimg.png/
Right-click on the .xib file and choose Open as...
There will be a list of options. Currently you are using "Source Code", which displays as XML. Use Interface Builder - iOS instead.
This will be remembered between sessions. I don't know how it got set to this in the first place.
Alternatively, you may be in the Version editor instead of the Standard editor - this will show xibs as XML in order to correctly display changes.
I used to be able to do this in XCode, and now suddenly I can't in a new project I've opened that was sent over by a friend.
Is there a particular setting I have to change to start this again?
I.e. there is a textbox I want to link via Code, and now I just can't. :(
Need help guys!
You most likely have an assistant editor window opened to a wrong class, you will need to check on your currently selected view controller and make sure that its the same that is opened in the assistant editor
Or in assistant editor, select automatic (check screenshot)
The solution for me was simply to press Ctrl while dragging...
I was having the same issue and looked all over and couldn't find a good fix to the problem. What was happening when my Controllers were first generated they had the generic names FirstController. When I switched the names I didn't switch the value in the Custom Class area. To fix:
Select View.xib
Select File's Owner under placeholders. This should be on the left side of the screen with a yellow cube next to it.
Select the third option on the utilities menu (Identity)
Change the Custom Class class to the correct Controller name.
I know this wasn't the specific question's issue but I clicked on this question a few times so thought if someone had the same issue it might be helpful.
With the latest version of Xcode when I open up the Storyboard and .h file, I remove the last space below the #end tag on the bottom of the (fresh) .h file. Which for some reason wouldn't let me place the outlet after doing so, thanks Apple!
So to fix my problem i have to have that extra space below the #end tag in the .h file.
This is what fixed my problem and I know it doesn't answer this specific question but hopefully, it helps someone.
I had the same problem, In my case there was a mismatch between my class name at the identity inspector and that one at source code.
Had this issue too.
XCode 9: make sure in the Storyboard -> Identity Inspector -> "Inherit from Module from Target" is checked (or fill out the module name manually)
EDIT: Turns out checking that box doesn't help -- if you delete the class of the UIViewController, then type it in manually and hit Enter, in XCode 9 if there's a problem the checkbox "Inherit Module from Target" will not auto check itself. After trial and error it turned out in the class (Swift 4), there was a #if IDENTIFIER .... #endif which was perfectly valid, but screwed up Storyboard connections some how. After removing it, typing the class name in the storyboard auto-checked the box, and now connections work. Yay another XCode 9 bug.
I have a problem with the new Xcode (today I upgraded). When I push on my file view.xib, I see the XML code, and not the graphics interface. Why? How can I see the "interface builder?
Interesting that this is the second time someone has had this problem. You can open the File Inspector on the Utilities bar on the right ( Opt+Cmd+1 ). Change the File Type under Identity and Type to the topmost choice. It should be Default - com.apple.InterfaceBuilder3.CocoaTouch.XIB.
Right Click on the .xib file and select "Open As". Then select "Xcode.IDEKit.TouchCodeIntegration.EditorDocument.CocoaTouch-title"
Perhaps you should look at this Article, it will explain a lot for you:
Xcode 4 Transition Guide: Designing User Interfaces in Xcode 4:
Why is Refactor... grayed out (disabled) in Xcode?
I'd like to rename a class.
Select the class's symbol in its header file - i.e. the bit just after #interface. Then the refactoring stuff should be enabled.
If you are using Objective-C++ (i.e. mix Objective-C with C++ code) then refactoring is disabled in xcode since it does not support refactoring of C++ code.
Refactor might also be disabled if affected files (most likely the file with your class in it) are not saved.
I've been using Xcode for 5 years now, and refactoring has never worked correctly (even xcode 4.6 has major bugs where it WILL corrupt your source code!).
The workaround has always been (still works 100%, even in cases where Apple's code fails)
use shift-command-f to find all uses of the file
select "replace" in the search settings
"replace-all"
do the following for the .h file, and REPEAT IT FOR THE .m FILE (if you have one):
right click the original file, and select "show in finder"
delete the file from xcode (select "delete references only" when asked)
rename the .h (and .m if you have one) in Finder
in Xcode, select "Product -> (hold down Alt) -> Clean Build Folder"
quit xcode (you can usually get away with not doing this - but NOTE: there are some other MAJOR bugs in Xcode where it crashes itself if you don't do this)
re-open xcode
drag/drop the .h and .m back into Xcode
wait a few seconds (some of Xcode's core methods are asynchronous - allowing it to corrupt your project)
finally, when it seems to be doing nothing (and your hard disk isn't making any noise any more): cmd-b to re-build
I have a 100% success rate with this method. I just tried refactoring with Apple's "Refactor -> Rename" in latest xcode and it failed - again!
(this time with the incorrect error: "Unable to determine the language of", one of those error messages where Apple put the wrong text in place)
I'm going to my project at finder, then change files name by get info.
After that, at xcode -> Project Navigator I delete the files.
At end, I click right on the class and Add files to ..., and add these files again.
It worked for me.
For me I realized Refactor was disabled because the Xcode project I had opened was referencing a Base SDK that was missing. Edit Project Settings and in the Build tab set the Base SDK to one that you have (like for me this was iOS 4.2). This enabled Refactor for me.
Also, it could happen that you renamed the filename for the class, either outside xcode or by ctrl-clicking the filename and then renaming it.
xcode refuses to refactor if filename does not match with the class name.
Go to your class' header file and find the line that looks similar to this:
#interface YourClassName
Right click on the class symbol (e.g. YourClassName) and you should be able to select Refactor -> Rename...
I just tried this and it works in Xcode 5.
This may be a bit late, but I stumbled across this post because I was unable to refactor my "ViewController.swift" file to "WhateverViewController.swift". I tried selecting the file in the Project Navigator and then selecting "Editor -> Refactor" from the top menu, but 'rename' is always greyed out.
Instead, what worked was selecting the ViewController name from the editor. So if you have:
class ViewController: UIViewController {
// Code here...
}
Highlight the "ViewController" word and then select Refactor from the menu or right-click and select Refactor -> rename.
Hopefully that helps...
Had this problem as well. I ran through trying to find missing SDKs, saving files, and looking for Objective-C++ code as mentioned above, and all it took to fix my machine was rebooting XCode.
Seems a little buggy still.
BTW, this was for XCode 4.0.1
Refactoring works If you first change the file name in the project navigator.