I've been following a tutorial on how to create a custom info window for the Google Maps SDK and when I try to connect the UILabel declarations in the obj-c file to the labels in the XIB file, nothing happens. I can't even connect the labels in the XIB file to the interface declaration and create them that way. Here's a link to an image of my setup:
Is this a bug with the new version of XCode or am I doing something wrong?
Go to Identity inspector and make sure that you conect your .xib with proper class.
You should have there CustomInfoWindow
Related
I know you can create a screen for an iOS app entirely with code. But when you use the interface builder part of Xcode, where is all of that information going? Is it being written to a file you can view?
A Storyboard itself is a file contained in your project folder, so you must create a storyboard file in Xcode in advance before using the Storyboard.
To create a storyboard file:
Press Command + N in Xcode ( or choose on File > New > File)
Then you can create a storyboard file, and you can find the file in Xcode Navigator or Finder.
If you want to check the source code of the storyboard file, just open it with text editors.
I have been searching how to convert a xib file into a storyboard file, but I can't find an answer, also I followed this tutorial but when I run the app the old .xib file is opened, no the new storyboard, my app has just two .xib files that I want to convert into storyboards, is there a way or tutorial at this date that can achieve that?
You must update your target configuration of the app. Open the General tab. In the secion Deployment Info you will find Main Interface. Choose your storyboard instead of the XIB file.
I am facing problem to connect an object with outlet so when i open assistant editor there are no related file found on automatic...why NSObject file showing always.
Right where Automatic is highlighted, to the left of that there is an arrow, clicking that solved my issue
Because the storyboard don't have equivalent for automatic.
You have to select manual and navigate to the desired source file
I'm trying to use the IB Designable and IB Inspectable in my UIButton but seems there are some errors.
In the Issue Navigator, the bundle file:
Storyboard :
IB Designables : Failed to update auto layout status: Failed to load designabled from path (null)
So I wonder if there are any configurations to do to use it in a static lib or something like that ?
This is
#import <UIKit/UIKit.h>
IB_DESIGNABLE
#interface CustomUIButton : UIButton
#property (nonatomic) IBInspectable int cornerRadius;
#end
My custom button I want to live render is inside a view controller
Unfortunately it isn't possible to use IBDesignables with static libraries (or static frameworks).
This isn't a great answer but I want to give some context on why.
It seems that the way Interface Builder loads classes to be shown as designables is by actually dynamically loading the dynamic framework that you create (and not your app's binary), and using the classes directly (after changing them using the Objective-C runtime quite a bit).
You can see that Interface Builder isn't loading your app, and just the individual frameworks with these steps:
Create a new Xcode project
Create a new framework target in the project
Add a class that is IBDesignable
In the storyboard from your app create a view and set its class to your framework's IBDesignable class
Click "Refresh All Views" in the "Editor" menu
In your DerivedData folder for the project, in the IBDesignables directory, you can see that only your framework target has been built.
Interface builder actually loads your framework using dlopen manually. You can also see that to facilitate this when building your framework, Interface Builder actually adds 2 RPATHs to your binary, so the dependencies can be found in the custom paths (you can view this with otool -L frameworkbinary). This method of loading your binary isn't possible with static libraries.
For what it's worth I think the best workaround for this is to build dynamic frameworks, instead of static libraries, but only for IBDesignable builds. You'll have to do some configuration work to do this, and it isn't easy to work around Xcode to have this work, but if you try it, you can use either the build path, or the environment, to differentiate IBDesignable builds vs "normal" builds.
EDIT: IB Designable and IB Inspectable do not seem to work with static libraries, so if you're using a static library, either consider using a dynamic framework (iOS 8 only) or move your component outside the static library, if possible.
For issues related with Cocoapods, use the following solution:
This is related to this question.
Here's the solution:
1) Install Cocoapods (0.36.0.beta.1) or newer;
2) Add use_frameworks! to your Podfile
See more here.
For some reason, I am unable with XCode 4 to connect a UITableView to the File's Owner in the XIB file. This connection is something I have done countless of times.
The File's Owner is a class which derives from UITableViewController.
I even tried the following
1) Used Interface Builder from XCode 3 (still have it installed) and there I am able to connect it no problem
2) In a different project, with XCode 4 I put a UITableView in a view and was able to connect it to the File's Owner even though that didn't derive from UITableViewController or implemented the data source protocol
This problem is happening to a couple XIB files in this project. Note this project and those XIBs were created using XCode 3.
Is that a bug or I am missing something?
Instead of connecting your UITableView to your DataSource in Interface Builder, just connect it like so:
[myTableView setDataSource:self];
Turns out restarting XCode was the solution. Well perhaps restarting my system too since I did both.