Why are two different UIToolbars, defaulting to different styles? - ios

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.

Related

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

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.

iOS Segmented Control does not appear in Interface Builder (or in the app)

So there is this main UIViewController, which has a Container View. Inside it lives a Table View with custom UITableViewCells. In some cells, I'm dragging and dropping a Segmented Control.
The problem: the Segmented Control keeps invisible in the Interface Builder and / or in the app (running in the devices).
This is not a z-order issue, I double checked.
I wonder if I'm doing something that is not allowed (a Segmented Control inside a UITableViewCell).
However: it works just fine for, say, that UISwitch over there. Or a UISlider. But the Segmented Control...
Here is a better version of the image below.
I can't say if it's the same issue for you, but I had my tint colour set to white.
Answering my own question since others may have the same issue: my solution was to recreate that View Controller. That's right, I deleted it and started a new one from scratch. I still don't know what happened.
I submitted a Technical Support Incident (TSI) to Apple, will update if I get anything back.

iOS 7 status bar overlaps with view - did they have to make it like this?

I know this has been asked before, but none of these solutions work, and that's the reason of my posting. Please do not close before considering my case.
My plist already has UIViewControllerBasedStatusBarAppearance = false.
I have already tried applying deltas, but to no result.
Changing the top level view frame in ViewWillAppear (like self.view.frame) did not succeed.
I thought of increasing the view height (storyboard attribute inspector), in combination with deltas, but my top level view X, Y are disabled in storyboard attribute inspector.
My main view doesn't have any children views because I load them into main view either dynamically or load them from XIBs which are again shared by more than view controllers. These XIBs provide layout for both Portrait and Landscape. I don't know what approach is ideal for this kind of configuration, but I would like it better if solution lies along these lines.
This approach worked partially, but gave me inconsistent results.
What makes the solution tricky is the fact that I have to support all 4 orientations - this is something I handle in code via didRotate and willRotate delegates for my other views, but failing to do it for statusbar.
Please help...
Could this link be of any help?
You might have to use the new setEdgesForExtendedLayout: method to get this working consistently?
Also, have a look at these official docs if you haven't already done so.
I ended up writing my own function to shift my all subviews (remember, not top level views whose frame is fixated by IB).
It didn't spoil my work but imagine if this was the case for a very big project with so many screens, the limitations would have made it a nightmare.

UITextView attributes inspector not showing full set of attributes

I have two Macs, both with the latest OS and Xcode versions. We're developing for iOS7.
On one Mac, everything seems OK. On the other, when I drop a UITextField onto a View Controller scene, the attributes inspector shows only a small subset of the attributes available.
I would expect to see something similar to the UITextView attributes but instead I see only this:
Have I done something wrong here or is this a bug? I seem to remember having edited attributes on a UITextField that I added earlier to another scene (font, text size, etc) but these are not available now.
I made a stupid mistake and I guess that someone else could do the same. I must have inadvertently clicked on the "Text Field" label at the top of the attributes panel and then scrolled up, missing it completely.
Doh!

Using UIToolbar above UITabbar - is it possible?

My question is similar to this one, but not exactly answered there.
What I want to do, is to convert an existing navigation-based app with different UIToolbars at the bottom of the individual UITableViews into an app that has a UITabbar interface. One of the tabs shall show the same hierachy of UITableView data as the existing app (which displays some kind of hierarchical data), whereas the others will be assigned something else (say: Settings, Help, ...) that is of no concern here. The idea is to allow the user to quickly switch to the "Help"-Screen from whatever stage of the navigation stack - and back.
For example, using 3 Tabs:
1. Database root (UIToolbar) - folder 1 (UIToolbar) - file 1.1
- file 1.2
- folder 2 (UIToolbar) - file 2.1
- file 2.2
2. Help (no UIToolbar)
3. Settings (no UIToolbar)
I have never seen such a design in any existing app, although the question cited above suggests that it might in fact be possible to keep the existing UIToolbars from the old app and simply place them above the tab bar.
Is this
technically possible (without problems e.g. with device rotation)?
allowed by Interface guidelines?
Although sample code would be appreciated, I mostly would like to find out whether it is worth trying to build an app like this - or whether such a design is a bad idea in the first place.
You can have a UITabBar anywhere, you just won't be using its controller. You will have to write your own controller and handle what happens during device rotation (or use iOS 6's auto layout features).
I tried it out, and now I can answer my own question:
It's possible, and there are no problems with device rotation, if you make sure that the views for every single tab can rotate.
Although it looks a bit unusual, I find it very usable. Of course, it costs some vertical space.
As for the implementation, I found it to be surprisingly simple:
All I had to do was to use Interface Builder to insert a UITabBarController in place of my original main UIViewController and move the latter to the first tab of the former. Then create some more tabs with UIViewControllers inside and rename their classes to those of my other existing UIViewControllers. Finally set the associated NIB-Files for all these controllers manually in the relevant interface builder inspector pane (because they are now no longer instantiated by my code) and change one single line of code to make the UITabBarController the root controller.
Result: the UIToolbar appears above the UITabbar for the first tab, but not for the others. Its position is fixed (when scrolling a list or similar), but it autorotates together with the tab bar and everything else.

Resources