How to distribute storyboard view? - ios

I’m creating an open source plugin for a developer to use a custom screen in their Apple Watch Extension and want them to add it to their storyboard. How can I package it and instructing them to included in their application (storyboard)?
Maybe something like the include tag in Android (link).

You can only use one single Storyboard in an Apple Watch app, so if you have done UI in IB then you will have to copy the InterfaceController (You didn't make a UIViewController right?) that you made to their Storyboard.
If what you did was all programmatically generated, which i haven't tried yet, you can give them your .m and .h file and they can include it to their project, and then instantiate a new InterfaceController of that class.

You could create a separate xib file or just add your storyboard containing just the one view controller to the project. The implementers can then instantiate the view controller using instantiateViewControllerWithIdentifier.

Related

How to create a corresponding ViewController class for a Storyboard ViewController in Xamarin

In a Xamarin iOS project, I have been using add -> new file -> ViewController and that creates a UIViewController class, a Designer file, and an XIB file. Everything is all well there.
I am now however making use of Main.storyboard and I added a new ViewController there (ProjectsViewController). I have already given it that class name inside Identity inspection, even though such a class doesn't exist yet.
I would like to get a view controller class for ProjectsViewController and I know I cannot just create ProjectsViewController.cs that inherits from UIVIewController.
What are the linking steps? I should eventually be able to access my controller outlets inside Xamarin (c# interface).
You can directly create ViewController outlet inside storyboard ,it will automatically create class in your project .
Open Main.storyboard with Xcode .
Create a ViewController inside storyboard.
Name the ViewController .
Save and open visual studio ,you will see that

New Swift Application Creates Obj C Files

I am a bit new to iOS development. Am I going crazy here?
I am using xCode to create a paged application. I select new project with the language as swift.
When I go to add a new view to the application it adds a view with Objective C?? Why? I want to use Swift. Am I doing something wrong?
Adding more screenshots, how do I get the second view to show me the Swift code instead of the "UIKit" code?
Working Side...
Not working
3:
It looks like your Assistant Editor is automatically opening the underlying Objective-C header files rather than the Swift files associated with your View Controllers. Try clicking on Automatic at the top of the Assistant editor, then hovering for a moment to see if your Swift file comes up (it should appear above or below the UIViewController.h file).
If you haven't created a subclass for the View Controller you've created in the storyboard, you'll need to do that first, then assign that class to the View Controller in the storyboard. To do this, select File > New > File…, select Cocoa Touch Class, and make it a subclass of UIViewController (don't create a XIB file). Then, in your storyboard, click on your newly-created View Controller (you can select it from within the view hierarchy on the left), open the Identity inspector, and set its Class to the subclass of UIViewController you just created.
If, for some reason, you've created a View Controller class and correctly associated it with the storyboard object and it's still not appearing, you can use the Manual selection in the Assistant editor to drill down to the file you want to appear.

How do I know which xib is the first one to load?

I am researching a huge Xcode project, how do I know which xib is the first xib be loaded by IOS?
In main.m, I can only know the main delegation file, but how to find the main.xib.
BTW, I search the {project}-info.plist, but found nothing.
Addtion, I know which file is the rootviewcontroller.
From your description the project doesn't use storyboard(s), so the initial window and root view controller are created by the app delegate. This may or may not use an XIB file (you'd need to check the implementation if the view controller class).

How can I rewire a MainView-iPad.xib to the viewController?

I am porting my Phone app to iPad.
I changed my target's "Devices" to Universal under "Summary".
I put the conditional (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad) to determine whether the app is running on iPad.
I created a new XIB dedicated for iPad and placed a view in there.
How can I rewire the IBOutlets back into the iPad version of the XIB?
Thanks
You probably need to define the class of the File's Owner:
Since you create a new XIB, it should be set to UIViewController, just select from the list your UIViewController's subclass.
The new image:
Just a small detail:
Avoid using this kind of stuff: (UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPad). It completely destroys your application architecture when creating a version for iPad and iPhone of the same application, which share the same code. Just sub-class the class you want. Keep the common code on the parent and the specifics in each sub-class.
select "Identity inspector" window on new Xib.
change class name to your viewController
then select file owner and your outlet automatically show up
there is the Controller class is same for both Xib
You don't need to rewrite any IBOutlets. But just assign the proper class to the xib's file owner and all the IBOutlets of that class is available to you and as you have used them in iPhone xib use them for iPad's xib.
Happy Coding :)

Using Storyboard how to interact with viewcontroller objects

I've reviewed many websites and youtube videos that have IOS 5 storyboarding information. Most of them are pretty basic and only describe how to get started with storyboarding and how to segue into other views. I'm interested in taking it a step further and actually adding custom code to the views contained within the storyboard.
Is the "normal" workflow when creating an IOS app using storyboard?
Create the layout of an app using storyboard (adding views and objects to those views).
Create viewcontroller files (.h and .m), one for each view contained within the storyboard.
Hook up the scenes from the storyboard with your own view controller subclasses by editing the "class" values in Identity Inspector.
I believe I followed those steps, but when I implemented step #3 above and ran my application, I was only able to see a black screen. The view I had created in storyboard wouldn't display.
You have the right steps. Make sure you create your .m and .h without a xib. Post your code for the view controller for your first view to get more help.
yes, this is the normal workflow. have you set the "initial viewcontroller? ?
see this image: http://dl.dropbox.com/u/31437518/Screen%20Shot%202012-01-24%20at%2012.29.34%20AM.png
It sounds like you made a storyboard file but it isn't being loaded.
Do you have the main storyboard setting in the target summary screen filled in?

Resources