How to set Nav Bar & Toolbar Background Images in IB - ios

How can I set a Navigation Controller's Navigation Bar and Toolbar backgrounds to be an image using Interface Builder?
I know how to do this in code and have done so in my app. But now I want my launch screen storyboard to reflect the app and I have to do this in IB as the app is not running at that time, so no code.
It looks like it cannot be done (no useful options in IB that I can see) so I am probably going to have to rethink the startup look and feel - but hoping for some solutions or workarounds I have missed...

Unfortunately this isn't possible, we can't write any custom class/code for the launchscreen xib/storyboard files, we can only design using resource files.
Maybe you can design some images that simulate your custom navigationBar/Toolbar.

Related

How to mimic Android Bar on iOS?

my designer created this layout:
How can I mimic that on iOS? I tried creating a Segmented Control but didn't work well because it can't be customized after iOS7. So at the moment I'm thinking about a UIPageControl with custom dots like explained here: Customize dot with image of UIPageControl at index 0 of UIPageControl
My problem is also with the concept. Segmented controls are said to be used to flatten/filter results according to iOS human guidelines while UIPageControl has actually different pages...
Is this the best approach? If so, can I make it look like the Android Tab bar?
Segmented control with custom image
UIPageControl with custom image
UITabBar on top (read too many bad things about this approach)
something else
If UIPageControl is indeed the best/correct/possible approach how can I make it look as close as the image? And also move it to the top?
Thanks!
Short answer: Don't do that. You're trying to implement Android controls on iOS. That leads to user confusion and an app that doesn't feel like a native app.
Instead, have your designer create a native app design for both platforms.
It looks to me like the closest analog to what you're trying to do is a tab bar and a tab bar controller (UITabBarController).
EDIT:
If you must implement this UI on iOS, you might have to roll your own. You'd create a new custom parent view controller with a child view controller that you could swap out, and a custom control that triggers the swapping. Conceptually it would be a lot like a tab bar controller.
You could probably set it up using a container view and an embed segue (The embedded view controller would be the starting child view controller) and then use the built-in support for managing child view controllers to swap out the child view controller when the user taps on your control. I've done this sort of thing before. It isn't that hard, and is pretty well documented.

Best practise in creating an uiview and presenting them in iOs

Is it a good practise to creates views in xcode and hide them and when required show them?
I am asking that because I prefer to create views visually and not in code.
If the view is to complex(a lot of subviews) should I create a new view controller to it?
I know there isn't a specify question here but I really need a clarification on this matter.
Regards
One of my first iOS applications had a tab bar and views that the user could switch between. Originally it was done by hiding and showing the right views depending on what the user pressed on the tab bar. This ended up being a complex disaster.
I then rewrote the app so that each tab bar view had its own UIViewController with its own set of views. That turned out to be so much easier to manage. (I also changed from using Interface Builder to straight code for creating the views, but that's beside the point and you can continue to use IB if you want.)
As for me, I prefer folowing practice:
Usually, a use storyboards,where views are placed, but if a view is complex, I create a separate XIB file, arrange all subviews there, and then in storyboard drag an UIView subclass and connect my XIB view with it.It helps to avoid mess in storyboard.
As for hiding views, I also don't recommend such practice as it can become very complex to understand your code and all those views are allocated when XIB is loaded, so the mobile developing rule "do as lazy as u can" is not met. We should try to spend as less memory as it's possible.
UIView is the best way to create iOS app, esp. if you want to reuse the code.
For example if you have same view to present in iPad n iPhone then using UIView can result in lots of similar code in View-controller
In another case if your view might need to have multiple table view it can be quite complex to handle each with delegates in ViewController. But separate view will solve this problem.
I have made my 1st open source code after learning how to use View
https://github.com/bishalg/BGRadioList
which I had learned from
http://www.raywenderlich.com/1768/uiview-tutorial-for-ios-how-to-make-a-custom-uiview-in-ios-5-a-5-star-rating-view
About the hiding view - I have used lots of hide and show view codes in my apps but believe me at one point it will become complex and unmanageable if you have lots of views.

IOS Tab Bar in separate xib file

I am new to programming in ios and I am trying to do something that I would think would be pretty simple but is turning out to be quite a stuggle. What I have done is created a window based app. Then I added a UIViewController subclass and checked "with xib for user interface". Then in my main application delegate I added an IBOutlet to the UIViewController subclass created and made it show when the application runs. Then in my mainwindow.xib file I linked the application delegate to the IBOutlet that I created. Now when I put a label on that view and run it, it works fine and shows my label. However, I am really unsure of how to make it display the tab bar control. I added the tab bar control but am unsure what to do after that. I have tried many things but nothing worked. If someone has any information on how to do this or something I am probably missing let me know.
Note: I have gotten the tab bar control to work in a window based app by adding the tab bar control and then in the application delegate adding the iboutlet and linking them in interface builder. However, i am unsure how to do it when using a different class to do so.
Any help is appreciated.

Place UIToolBar above UISplitViewController?

I'd like to place a UIToolBar above a UISplitViewController but Interface Builder will not let me do so (using the standard split view template as a start). I know I can implement different tool bars in each of the two views within the UISplitViewController, but I want one seamless bar that lies outside the frame/bounds of the controller, directly above it and right under the status bar. Please help.
Thanks.
This is not supported by the UISplitViewController. If you need this sort of UI you would typically create a custom setup to achieve this.
I'd construct a setup using two UINavigationControllers that are controlled using my App Delegate and just take it from there. There will be some extra work for you, handling rotation, but that's to be expected when doing custom stuff.
This shouldn't be too hard.

set "default" UIViewController background image?

Basically I've got the same background image throughout my entire iphone application.
I don't use XIBs (nasty things :p).
So I was wondering if there was any way to add a "default" background image to all of my UIViewControllers?
I tried subclassing UIViewController and created the class UIViewControllerWithDefaultBackground, but changing over all my uiviewcontrollers to subclass UIViewControllerWithDefaultBackground just crashes my app. Plus half of my views are UITableViewControllers... but I'd be happy just having to change 2 classes... :p
Is there any way of doing this? I just don't want to have to copy and paste the same 3 or 4 lines of code into every single class I'm initiating. Plus, if I want to edit it at any point (take out the navigation bar and extend the view lets say) then I would have to change all my different classes.
Is there no easy way to do this programatically?
Thanks
Tom
If you add a UIImageView to your UIWindow in your app delegate (make sure it's below the root view), then make sure all your VC's are opaque, that should solve your problem.
This would be easier to do in IB, especially if you have a MainWindow .xib already created (albeit blank)--you just drag and drop the image into the UIWindow.

Resources