I have downloaded the latest varsion of Xcode. All the tutorials i see for creating a new ios application project, mention to create a view-based application.
But I do not see that option. Therefore, whatever I choose, next I do not see the folders mentioned later in the examples. (for example I see no resources folder in my project)
The picture I see when to create a new project is this:
What to do?
"Single View Application" is the same as the good old "view-based application"
In new X-code you won't find window based application option. If you want then select
Empty Application option. Also you will not find MainWindow.xib here. You have to do coding in Appdelegate file to load initial viewController.
If you select Single view Application as Antonio said you will have all viewControllers in a Storyboard. Which is introduced in new iOS 5.
You can create new folder and name it to resources.
Related
I'm trying to localize my app.
I noticed that if I add a language every localized file become doubled.
In this way it's impossible to maintain code or storyboard so I learnt that I need Base internationalization.
The problem is that when I select that checkbox in xcode project setting it shows a window without nothing to select, does anyone know how to fix this?
Here's a screenshot
First, you need to go to your storyboard file, open the bar on the right side, and go to Show the File Inspector, the furthest tab to the left. Then, scroll down and click localize. After this, when you check Use Base Localization, you should see the storyboard appear.
This could happen if Base Internationalization was active before then disabled and files deleted manually.
Create Base.lproj folder in your project folder using the finder.
Move your main story board to it also using the finder.
fix the reference to it from Xcode.
remove app. from device, clean & build your project.
All will be back to normal.
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 made a generic app, and from that app, I use different images to make different apps (same app, different images).
My idea until now has been every time I was generating a new app, I copied the code and changed the images (and sometimes some lines of code). But every time I change something in the main app, I have to change it in all the sub-apps.
I've been thinking about using target for this (every time I create a new one, I use a new target with a new folder images linked to it), but I'm not sure about this as I never worked with targets before.
Is this the best approach?
And if it is, how is the best way of doing it? I created a new target inside my project, but it creates a whole new project inside of it, with its owns classes.
For your case, using multiple targets is a good solution. For each target you'll include all sources, and only the images used by that target (images can have the same name, just put them in separate folders).
On Xcode 4, you'd need to follow these steps:
Go to Project settings, right click on your main app target and choose 'Duplicate'. This will already include same sources from the main app.
Unlink all images that you don't need in your new target:
select all images that you want to unlink, and in the utilities panel (usually placed on the right), in the 'File Inspector' section, uncheck your new target
Create a new folder in which you place the images for your new target/app, and when you import them in the project, choose to link only with your new target.
When you duplicate your target, it will also automatically create a new info.plist for your new app. You'll need to change the bundle id, and any other options that you wish.
Another option would be to make the main project as a static library, and in all other projects include the main project, and link the target. Won't get into this, since the targets solution seems better for your case, for only changing the images.
I wish to add a link showing howto - in support of the above answer. Hope it will be helpful to others also.
iOS Mobile Development: Using Xcode Targets to Reuse the Code
http://www.itexico.com/blog/bid/99497/iOS-Mobile-Development-Using-Xcode-Targets-to-Reuse-the-Code
I delete the storyboard by mistake from my app.
Where I can find it and restore it,
or I lost it?
The default storyboard filename is Main.storyboard, so that's what you should look for unless you gave it a different name. (Older versions named it MainStoryboard.storyboard, so if you are working on an older project, you might need to look for that instead.)
First, check your project folder (using the Finder). If it's there, you can drag it back into your project in Xcode, or you can use the “Add Files to …” menu option.
If it's not there, check the trash can. If it's there, you can right-click it and choose “Put Back”, then follow the steps in the previous paragraph.
Try running again your app and Xcode will create the file automatically, this worked for me.
I just bought the book: Sams Teach Yourself iPhone Application Development in 24 Hours.
In the book it uses xCode 3.2.4, so I went ahead and tried xCode 4.3 (the current version), but I didn't understand what to do...
I then found this page...
https://developer.apple.com/downloads/index.action
I downloaded the version of xCode used in the book (just so I could see the same thing the book shows).
But, I'm getting two errors each having something to do with the Interface Builder...
"This version of Interface Builder does not support documents of type "Interface Builder Cocoa Touch Document (XIB 3.x)" targeting "iPhone/iPod touch"."
And it comes up twice for two different documents in my xCode project.
How can i get it to work? In the book the code I put in works just fine.
Also my Mac Version is: 10.7.3
Do not waste time learning anything about Xcode 3.x. That would be like learning how to build catapults and siege engines in preparation for a career in the military.
Apple completely rewrote Xcode with version 4.0, and every single thing about the user interface is totally and completely different. If you invest time learning 3.x, you will be totally lost and confused when you move up to 4.x (version 4.3. was just released, and there is yet a new version on the horizon.)
I was totally lost and confused for about 2 weeks when I made the move from Xcode 3.x to 4.x, and I do this for a living and have been using Xcode for over 6 years now.
Unfortunately, the iOS development books are behind the curve when it comes to versions of Xcode.
Do yourself a favor and set the Xcode 3 book aside and find an Xcode 4 book (an ebook might be a better choice, since they can be updated.)
From what I just read, the xib files you have are not compatible with the newest version of Xcode.
You may learn loads by fixing this.
Don't delete the two files yet...
Will the xib documents still display in IB?
Try this:
Rename the two xib files to some other name.
*) With the old file open in IB, click View, Utilities, Show File Inspector.
Click File's Owner, Rename
1) In toolbar click File, New, File
2) Choose User Interface, Empty, Next, Next
3) Type the name of the corresponding .h file, be case sensitive. Click Create.
4) Click File's Owner
5) With the new file open in IB, click View, Utilities, Show Identity Inspector.
6) For the class name, Use the class name in which you are attempting to fix.
7) Drag a New View object to to the canvas, right click the new view, and set a Reference to the file owner's view variable by dragging to File Owner.
At this point, you could attempt to copy all the objects out of the old xib and paste to the new one. Make sure you check all referencing outlets and target action stuff.
8) Delete the old files in Xcode by right clicking and choose Delete, References Only.
Let me know if this works or not.