enter image description here
Im a noob when it comes to this but, I wanted to show the storyboard file that I made instead of the "Hello world" when I launch the app. Pls Help..
You created a SwiftUI project in your screenshot. That's why you have code instead of a storyboard file.
The fix is to choose Storyboard from the Interface menu when creating the project. Then choose File > Add Files to ProjectName to add your storyboard file to the project. Xcode defaults to using SwiftUI for new projects so you have to explicitly choose Storyboard to use storyboards for your app's user interface.
If you don't see the Interface menu in the second step of creating the project, make sure you didn't select a Multiplatform project. Multiplatform projects don't have the option to choose a storyboard for the user interface.
I'll create a new file while the group is selected, but the file gets created outside the project hierarchy.
What gives?
I was able to get it done with this workaround:
Create the Cocoa class
⌘-drag it into the project/folder I want (unchecking 'Copy items if needed' and selecting 'Create folder references')
Delete the files that are outside the project by Right-Clicking, selecting 'Delete' and then 'Remove References'
You can create a Swift File instead of cocoa class file.
I created a project in Xcode 6 beta 2, which initial had a storyboard. I wanted to work with separated xibs so I removed storyboard and line related to storyboard from Info.plist and added several xibs. Now the problem is that I can't connect file's owner 'view' outlet (because it's not visible) to view from xib. First thought was that I misspelled name of the file's owner custom class name (from Identity Inspector), but I didn't. Also file's owner class is a UIViewController child. I don't know that the problem can be. Did some faced this issue ?
It's probable that you need to close Xcode, clean the project and try again. I created a new project without storyboards and I did the following:
1) I created the nib file.
2) I created the UIViewController class.
3) I opened the nib and selected the File's owner tab. Then I wrote the name of the custom UIViewController class.
4) Without selecting the file's owner tab on the Placeholders left bar (make sure of this) go to Connections inspector tab and you should see the view outlet.
Simply cleaning, quitting Xcode and re-opening fixed it for me.
Hi i get problem with xCode 4.
I develope project with XCode4 on home and on work.
And i store it on my USB flash drive.
Today i get some problem.
I open xib file for add outlet to code and get next error "Could not insert new outlet connection: Could not find any information for the class named ..."
Class exist and property of xib file setted correctly.
Could not insert new outlet connection: Could not find any information for the class named
Ok, think i, i write code and the connect using Files owner.
Next step i open code editor of .h class file and try to write UI... and see nothing. i dont get list of classes UI types
Next i saw what XCode code editor does not highlighting classes of UIKit and else frameworks too.
But i dont have this error on another projects and on it project but on home computer.
Some body have same problem?
Try this: Close your project. Choose Window > Organizer from the main menu. Select the Projects panel. Select and delete all copies of your project from the list. Open the project again (Xcode will rebuild the necessary information).
This will not delete your project, but the index and other information Xcode discovers about your project. As I said, Xcode will rebuild the information as soon as you re-open the project.
We had a really similar problem happen to us and none of the help out there worked. What did end up fixing it was deleting the .m and .h file from xcode (resource only) and then dragging them back into the project from the project folder. It seemed to relink everything and make it work again.
Just add .m files in Compile Sources under:
<My Project>
-- TARGETS <My App Name>
-- Build Phase tab
-- Compile Sources
It fix the problem.
I noticed that .m file was moved inside en.lproj folder.
Just delete (reference only) the .m file from the Xcode and moved .m out of the en.lproj.
Add it again.Don't worry, you will get all your connections back.
It will fix the issue.
I just updated to Xcode 4.
Normally when localizing apps we add "Localizable.String" file to the project, and then navigate to "Get Info" menu and click the "Make It Localized" button.
However, in Xcode 4, there is no "Get Info" menu.
When I try to add a language it only effects the "InfoPlist.String" file (which can only localize the app's name).
How may I add localization to my app in Xcode 4?
It's simple once you understand it.
If you want to accomplish this with Xcode 5.x and iOS 7 or Xcode 6.x and iOS 8, check out "How to localize my app with Xcode 5?" instead.
I liked SNR's link, but his answer was a bit short.
Also, I see that this question is a bit old, and my answer may be different from older versions of Xcode. (I used Xcode v. 4.3.3)
However, i have updated my answer to work with both Xcode 4.3.5 and below + 4.4 and above (and Xcode 5.x and 6.x here: How to localize my app with Xcode 5?).
To begin you should add a new "Strings File" in the iOS Resource category.
Next, create the file as "Localizable.strings".
When the file is created, select it and open File Inspector .
EDIT: Things have changed (a bit) with the new Xcode 4.4, 4.5 (and above) (for iOS 6 support).
If you'r Not using Xcode 4.4 or above, joust skip this step.
{ The Xcode 4.4, 4.5 (and above) way:
Click the "Make localized" button
Now head over to your Main Project page.
And click the "+" button under Localization, and select the languages you want to support.
(I'll select German / Deutsch)
Now a window will appear asking you what files you want to localize, make sure Only the "Localizable.strings" file is selected and click Finish.
}
{ The Xcode 4.3.5 and below way:
Click the "+" button under Localization, and select the languages you want to support.
(I'll select German / Deutsch)
}
.
.
.
.
You should now see that you have two files under the "Localizable.strings" file.
Next, add your localization strings inside both of the localization files.
Now here comes the coding part.
Here i'll simply declare a UILabel and set it's text to the Localizable file string.
Declare:
IBOutlet UILabel *testLabel;
And Inside ViewDidLoad i'll set the text using NSLocalizedString:
[testLabel setText:NSLocalizedString(#"TEST", nil)];
To finish up, just connect our testLabel in "Interface Builder".
Now you should be able to run the Project and see the localized string.
And if you change the language, you should see the localized string change as well.
Select the file you want to localize and klick on the file inspector in the utilities section.
There is a section Localization
You can view the file info (and add localizations) when you select the file and open the "File Inspector" via the main menu's "View" -> "Utilities" -> "File Inspector".
first you need to add new Localizable.string file and select it and go to View" -> "Utilities" -> "File Inspector click on + button to add language in localization section.
also check it XCode 4, Adding localization
the way of Localization in xcode4 has changed! right click the localizable.strings, and to add support for another language, simply click on the ‘+’ in that ‘Localization’ pane on the right.
You can take advanced of the User Defined Runtime Attributes:
http://cupobjc.blogspot.com.es/2014/04/interfaz-builder-localization.html
First define a new category for UILabel:
#import "UILabel+Localized.h"
#implementation UILabel (Localized)
-(void) setTextLocalized:(NSString *)aText{
[self setText:NSLocalizedString(aText, nil)];
}
#end
Then in the interface builder, User Defined Runtime Attributes :
textLocalized String your string to localized
And you don't need to declare the IBOutlet,
and don't need code this in the ViewDidLoad [testLabel setText:NSLocalizedString(#"TEST", nil)];
If you want a dynamic way of switching languages inside your app AND using a Pods based solution check out:
https://github.com/nullic/DPLocalizationManager
Install with: pod 'DPLocalization', '~> 1.2'
It supports the same standard localization files but also uses dynamic linking using User Defined runtime attributes and also inside code such as viewDidLoad.
Some examples in the example project:
self.startup.text = DPLocalizedString(#"TITLE", nil);
self.label.autolocalizationKey = #"LABEL_TEXT";
[self.label updateAutolocalizationArguments:#[#"Hello", #1234567890, [NSDate date]]];
self.autolocalizationKey = #"TITLE";
Download the git project that includes example project showing several examples.
Or you could use TraductoPro to automate this process for you and save a lot oftime. It is a Mac app that integrates well with Xcode.