Setting Modal Presentation Style causing views to disappear (Xcode 6) - ios

I have set up my view in interface builder. I am using auto layout which has been set up also.
If I present my view with the following code:
GlossaryViewController *glossaryViewController = [[GlossaryViewController alloc] initWithNibName:#"GlossaryViewController" bundle:nil];
glossaryViewController.delegate = self;
glossaryViewController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:glossaryViewController animated:YES completion:nil];
Then everything works fine. However if I change modalPresentationStyle to a smaller style such as UIModalPresentationFormSheet then none of my views are visible when the view appears.
I have even tried testing it with just a UIImageView that is set to hug the four edges. Even this disappears.
Before I upgrade to Xcode 6 I had created similar views that still work fine. This has only occurred when creating a new xib.
Has anyone else had similar issues?

After deleting the app, deleting the troublesome nib, doing a clean, restarting xcode and then recreating the xib I still have not be able to get this to work. This was after attempts at changing the size of the view, orientation and playing around with auto layout.
The behaviour is rather odd. Sometimes a single view might show but adding any others by it does nothing.
I have hopefully found a work around for now. If you do as follows:
Click on files owner and then go to the 'Show file inspector' tab.
Next look for 'Interface builder document'. Under this heading is 'Opens in'. Change this from 6 to 5.1.
The following popup appears. (WARNING: if seems once you have clicked 'Disable size classes' there is no going back. So make sure it's what you want to do):
Select the option you want to keep. So if the xib is just for iPhone then select iPhone. This will then give you back the way it was in xcode 5. Basically it's converting it back to a xib that handles either iPhone or iPad and not both.
Look forward to hopefully someone being able to explain what I am doing wrong or if there is some sort of issue with interface builder at this moment in time. Be good use the new interface builder instead of switching back to xcode 5.1 xib interface.

Related

Suddenly xcode hided the views in interface builder Storyboard - iphone

The app was working normally, till I committed my code using Git for pushing the code online. The views were hidden from the interface builder (storyboard) suddenly.
It shows the views this way:
the interface builder does not show the faded views as well:
I tried to check for the source code of the storyboard but nothing looks wrong. what can be a possible error that cause this problem ?
You are looking at what happens when you have designed your views in a particular size class and then, when you look at the storyboard, you are not in that size class.
For example, let's say you happened to be in size class H:Regular W:Compact when you put "top line" into its superview in Interface Builder. At that time, the bottom of your Interface Builder canvas would have shown something like this:
That blue is supposed to be a warning that you are working in a specialized size class! But you, I am postulating, paid no attention to that warning.
Okay, so now you come back later and you are in size class H:Any W:Any. What you are showing in your screen shots is just what I would expect to see.
You would also see something like this at the bottom of the attributes inspector when you select one of the views:
That would show that you've accidentally installed your view in a specialized size class and not in the size class you are in.

Xcode Interfacebuilder bug?

I got a problem in the Xcode project.
below image shown UITabbar problem. I thought it's a Interface builder bugs.
UITabbar showing a dark color. That only shown a root & one-depth ViewController.
How can I solve it?
Thanks.
== Modified ==
The problem suddenly appeared.
It is not known whether the problem is caused what.
TabbarItem area is like a shown bug as image.
I hope Tabbar area to be displayed correctly.
I tried to various way to solve the problem.
tried ways as a below :
regenerate xcode project and then copy storyboard. => fail
regenerate storyboard and then copy partial elements in storyboard. => fail
regenerate all of them. => I did not try yet.(have too much elements. I want to avoid like this way.)
Interest point is sometimes display correctly. When I first open a simple storyboard file(Default UITabbar Project's main storyboard) like a below image.
it bring to me confused.
I'll summarize what I know about storyboard that may cause similar issue...
Assigning images that have incompatible width:height ratios to tab
bar items
Not assigning any images or not using any system images for tab bar
items
Hope this can help anyone else that has similar issues...

Editing toolbar in Xcode 4.6 - unable to add Bar Button Items

I am attempting to add a toolbar as an input accessory, and as such have added it via xcode storyboard editor to the view controller (and not within the view). This was as specified in this tutorial(which seems to be written for an earlier version of xcode): reference
My issue: "8.) Now we need to open the toolbar item itself. Double click Toolbar in the document window."
This is no longer valid behavior in Xcode 4.6 it appears, so I ask you: how do I add button items to a toolbar? I would prefer to avoid doing it programmatically (Still reasonably new to xcode development and normally make my GUIs with storyboards) but if I have to, I have to.
Many thanks!
If you're doing what I think you are doing, adding UIBarButtonItems to a UIToolbar, then you simply drag a Bar Button Item out to the toolbar.
However, I would assume that what they mean when they say 'double-click' is not what people normally think of when they think double click. Try double clicking slowly this often does the trick.
Found the issue - it was appearing behind the UIView. However you dont ever need to graphically interact witha toolbar, you can just drag-and-drop controls onto it in the sidebar. If there is a need for more info on this message me or vote up.

How to size container view's child view to fit iphone 4 and iphone 5 screens

I'm trying develop my app for iphone 4 and 5. However I encountered problem with container view. My view looks like this:
Now, I tried to google a little bit, and found, that I can set size of my views in project settings by uploading picture in different sizes (so that all my views will get resized automatically). This is true for all my views except my container view.
So my second attempt was to size my view in appdelegate like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
_window.frame = CGRectMake(0, 0, 320, [[UIScreen mainScreen]bounds].size.height);
}
This unfortunately did nothing to my container view.
Only solution I found so far, was to set height of my embedded table view, by setting it to 458 in size inspector in interface builder. This sets it to fit iphone 5 screen, however on iphone4 (and in simulator) it is too much and some of my rows are below screen (as I expected).
If anyone could help me, I'll be glad, because I really don't know how to deal with this problem ;)
Well I would look into your constrains and your origin settings, incase you made any changes without knowing. Here is an example:
Make sure the origin settings are set to the top left "dot" like in the image and check your constrains parents (Superview in this case). Tip: The key to editing constraints in interface builder is never to drag and drop anything once you've added it to the view. Move and arrange things by editing the constraints instead.
You can also turn off the Auto-layout and do it manually
Here is also a great article on auto-layout in interface builder and apples own documentation on Resizing the View Controller’s Views and children's views (which a container is).
My last tip before you either have to try my last solution (which is underneath) or get the answer from someone else, is to check your architecture settings.
If that does not help it might be caused by some unknown random error that is hard to find, and I would suggest that you try to clean your project first by clicking/holding down "Shift" "command" and "K", and if that does not work, just start a totally new project and copy all the code and files over to the new project. This should help since the problem that you have should not be accruing since it should be dealt with automatically, but seemingly random errors do accrue on occasions.
I hope one of the tips help you out, if not I'm sorry.

Why are two different UIToolbars, defaulting to different styles?

Consider the following two toolbars that are in the same project of mine:
Notice that these toolbars look different? The problem is that they were both created by dragging and dropping them into IB, and I didn't change any of there associated properties. All that I did change was adding the flex controller, and change the text on the initial UIButtonBarItem. Other than that, these Toolbars have not been modified and, furthermore, I've verified that their properties are exactly the same in the Attribute inspector.
How or why are they different? Furthermore, how can I get the first, bluish UIToolbar to look like the grey one since the available Black Opaque and Black Translucent styles look nothing like the grey one?
Am I missing something? This doesn't make any since.
I've found why this is happening but I'm a bit clueless on how to change this. See this, new question regarding a fix for this issue.
These Toolbars are changed due to internal Xib settings that are specified when the Xib is created. In the first example, when I created the UIViewController I must have unchecked the Target for iPad check box, even this is for an iPad project.
This changed the default size of the initial UIView that was in the Nib. I always cut off the statusbar and set the view to be freeform in sizing as soon as I create a UIView within a Xib file, so I can never tell by looking at my views whether they were targeted for the iPad or not.
When I created the second UIViewController object, I checked the Targeted for iPad option. Now, my toolbar is styled with a grey tone.
The lesson learned is obvious-- if you want consistency in the default style of your objects that you pull from the IB Toolbox, be sure to create your UIViewControllers, specifically targeted for the iOS device. If you've made the same mistake that I have, follow the linked question above for how to revert your UIViewController and Xib file to the other style of View Controller.

Resources