Xcode 4 Orientation to Landscape grayed out - uiviewcontroller

I'm trying to create an ipad app in xcode 4 that supports ONLY landscape view. By default the MainWindow.xib file displays the interface in Portrait mode. I cannot change it to landscape mode because the option is grayed out.
If I create a UIViewController subclass, I'm able to rotate that new view to landscape. Just not the original MainWindow.xib viewcontroller.
The way I've been able to work around this, is to create a second view controller and set that to landscape as the option is not grayed out on this one. Then I create a button on the first view controller that switches to the second one where I place all my objects.
There has to be an easier way to have the main viewcontroller "MainWindow.xib" appear in the interface builder as Landscape. I just can't figure it out. Do I really a second view to have a landscape xib to create objects on? If so, how can I have that second view be the main view so that I don't need a button to switch to it?
I'm totally new to Xcode and IOS development, so please forgive my noobness.

Related

Flash builder / Flex mobile tabbar without container and with custom functions

I am developing app in Flash builder 4.6 as Flex Mobile project.
I have 4 different views being shown inside ViewNavigatorApplication. One of the views need to have tabbed menu bar at the bottom of the screen. That tabbar needs to control sorting method of list element. I could use custom made tabbar but I really want the same look and feel as the one that comes with TabbedViewNavigator. What are my options for doing such tabbar?
Should I use TabbedViewNavigator as application container and start showing/hiding the tabbar as necessary for every view (then I must overwrite the tab buttons handler so that it wont change the view but do the sorting instead) or is there a way to extract the tabbar from TabbedViewNavigator and simply add it to one of the views?

Child content view controller view has wrong bounds size from Storyboard?

This document outline from my sample Storyboard shows what I'm working with.
I have a custom container view controller and two content view controllers connected via embed segues.
Here is the storyboard itself.
ZetaViewController has to create some programmatic views (within ZetaView, of course). I noticed when I was centering these programmatically created views they seemed really off center.
ZetViewController is centering things by examining self.view.bounds.size.height and self.view.bounds.size.width and doing some appropriate arithmetic.
When I added debug logging to ZetaViewController, I noticed that self.view.bounds.size.height and self.view.bounds.size.width had dimensions equal to ContainerView (768 x 1004) and not ZetaView (728 x 637). The Size Inspector in IB confirms these values.
I created a distinctive value for the tag attribute of ZetaView and logged it. ZetaViewController.view really is ZetaView because the tag value confirms it.
So what is going on? Why would ZetaView, shown clearly with smaller dimensions on the Storyboard and in the Size Inspector, show the wrong values in it's properties during run time?
My problem had nothing to do with Storyboards, segues, or custom container view controllers vs content view controllers. It had to do with the new Cocoa Auto Layout features introduced in iOS 5.
My problem arose from inspecting view bounds size in viewDidLoad instead of in viewWillLayoutSubviews. At the time viewDidLoad is called, the view controller's view has not been given its proper size yet. When I moved the code which programmatically centers views to viewWillLayoutSubviews, it worked as I expected. I still leave view creation code in viewDidLoad because viewWillLayoutSubviews is called repeatedly as layout changes.
See also the View Programming Guide for iOS section "Tweaking the Layout of Your Views Manually".
Ok,I'm going to point to an excellent post that I found: (updated)
http://kevindew.me/post/18579273258/where-to-progmatically-lay-out-views-in-ios-5-and
I was having an awful time adding shadow calayers to views after autolayout had done its magic. viewDidLoad, viewWillLoad etc did not have everything correctly laid out.
viewWillLayoutSubviews is called quite a few times and the state isn't fully set up. However... In viewDidLayoutSubviews, finally everything was set up as I expected.

set default orientation for the android mobile view using flex 4 and action script 3

currently I am developing Video Conference system for android mobile using Flex 4 and action script 3. for video Chat I have 2 views, 1. Full screen view and 2. Normal Screen View. now the question is, how can I set the default display orientation for the view. when I click full screen, the view must load on "Landscape" orientation and when I click Normal screen, then the view must load "Portrait" view. I have tried the Stage.orients. but using that I can set only one orientation for an application.
<aspectRatio>portrait</aspectRatio>
<autoOrients>false</autoOrients>
stage.autoOrients = true/false;
stage.setOrientation( StageOrientation.DEFAULT );
Kindly any one help me to solve this problem. Actually I can set default Orientation for One View. but I need to set Different Orientation for different Views. for FullScreen I need to set Landscape as default Orientation and for normal screen I need to set Portrait as default Orientation. any idea ?
I do this by using setAspectRatio:
this.stage.setAspectRatio(StageAspectRatio.LANDSCAPE);
Just listen for addedToStage inside the view and change the orientation there.

Dynamically resize iBooks HTML widget

I want to create a dynamic widget for iBooks 2, but I can not dynamically resize the widget to match portrait or landscape mode. I found Apples documentation for resizing dashboard widgets but this doesn't seem to work within iBooks.
As an alternative it would help, if I can lock the orientation for the widget.
Is there a solution to this problem?
There is a widget object that is instantiated in dashboard and iBook contexts. It is not clear, however, if it contains any information about orientation.
It may be possible to add a listener for widget.didEnterWidgetMode, as demonstrated in this widget events demo project on github, and then read your window dimensions. This should tell you whether you are in portrait or landscape.

MonoTouch - IOS5 Storyboard - Additional View Controllers

I am new to Monotouch and I am not finding the right documentation to do this.
I created a new iPad Storyboard Single View application. I have my inital Navigation Controller, my initial View Controller, and then I added two more View Controllers (Pages?). I created a button on the first two pages. I held down control and dragged each button to the next View Controller and setup each Segue as a push. When I run my application, I can move from page 1 to page 3 and back, no problems.
Now the problem is when I start adding controls and trying to wire them up. On the initial View Controller, I can hold down Control and drag controls over to the code and after I give it a name, it automatically adds my outlets and actions.
But the new two View Controllers I cannot do this. I have searched every where and the StoryBoard documentation and examples are difficult to find. Any help would be appreciated. Thanks!
You need to create a UIViewController class for each of the new View Controllers in Xcode, if you right click on the folder for where you want to create the class, then click Add New.
You then need to then wire them up to your View Controllers in the storyboard (you will see a drop down which shows the name of the class for the view controller in the properties I think it's the fourth icon from the right, it will be UIViewController). Once you have done this, you will then be able to wire up the controls on it.
Once you've saved it, it will automatically create the C# classes in MonoDevelop when you switch back to MonoDevelop. Don't try and do the class in Mono first as it causes you all sorts of issues!
Hope that helps, if you want more information about storyboards, I've found that the objective c stuff is about as good as you can get for now as there isn't too much support for monotouch storyboarcs yet.
Davoc