In my application currently I have implemented custom view in place of UINavigationBar. But there are 14-15 screens. So I repeatedly created that top view fro each screen.
So while surfing for the solution to avoid this repetition. I came across the concept of UIAppearance. But I don't know how to implement it. I have also gone through some basic concept of it but still I am very confuse.
My top view is bit different for each screen. Like in 4-5 screens there is Two buttons(back button on left and call button right) with one label in center.
Then in other 4-5 screens there is two buttons(cancel button on left and call button on right) with one label in center.
Then in other 2-3 screens there are two buttons(side menu button on left and call button on right) with one label and icon in center.
Can anyone tell me how to achieve it using UIAppearance?
Thanks in advance!
You can't set buttons via UIAppearance. If you are setting titleTextAttributes on each page (for say, font, size and color), you can do that via the UINavigationBar appearance like this:
[[UINavigationBar appearance] setTitleTextAttributes:attributes];
The attributes pointer is a NSDictionary containing your textAttributes (NSFontAttributeName, NSForegroundColorAttributeName etc.)
Related
How can I implement swipe to see more options? There are lot of libraries that I could readily use, but they all are designed for iPhone apps. In iPad you have a lot of space, and I want to stack the buttons vertically instead of horizontally.
Is there any library for this? If not, how should I go about building this as a custom cell?
I tried building a custom UITableViewCell class which adds a UIScrollView, but it's not the same as showing the buttons beneath the cell.
Based on your inputs I have created a simple custom cell with basic functionality of swipe to see utility buttons and of course buttons stacked vertically.
What I did was, add a UIView beneath the cell's content view and positioned at right. Now depending on the number of buttons provided each button's height is adjusted accordingly. And delegates are provided for button clicks.
Swipe gestures are added. On swiping left it will animate and shift the cell's content view to reveal the button view. On swiping right it will reset the cell to original position.
You can customise it from here onwards as you wish :)
I have uploaded them over here : https://github.com/srikanth-vm/GSSwipeableCell
I have seen many examples of the raised center button on a UITabBar, most being just a UIButton placed over the top but all of these need coding on every view, Is there a way of creating this without having to program every view so it will appear on every screen, perhaps something in the app delegate?
I want to achieve a UITabBar with a raised circle in the center.
Subclass UITabBarController. I've found an example here: Raised Center Tab Bar Button.
I'm working on a iPhone app which shows an mobile webform in a UIWebView. I'm using a default iOS layout with a navigation and tab bar.
The mobile webform is displayed in a UIWebView in the white area. Since the webform has a lot of input fields, we really need as must space for it as possible. Because of this, we are planing to remove the tabs in the bottom. Over time, there will be more tabs/sections, so it is not a solution to just add a button for each section in the left side of the navigation bar. On a iPad a popover could easily be used to handle this.
Is there a standard iOS layout mechanism to handle this change of sections/views without using tabs?
You could do something long the lines of Path or the new Facebook app and have the "table of contents" behind the Navbar and the navbar slides away (along with the child view) to reveal it. When done right (ie smoothly) I think the effect is really cool.
This would also work great as you add more and more options, since the table could just scroll.
Here is a framework that might be you started: http://www.cocoacontrols.com/platforms/ios/controls/iiviewdeckcontroller
I would consider replacing the navigation bar's title with a control that lets you switch between tabs. You can assign the bar's titleView property to a control or a button and it will generally do the right thing.
If you're limited to 2-3 tabs, you could simply use a UISegmentedControl.
If you want more, you could use a button which, when tapped, pops up a view that allows you to select the view you want. This could be a modal table view, or you could slide up a UIPickerView from the bottom of the screen, similar to the keyboard.
I use this technique in an app of my own, screenshots here. Tapping the button cycles between views (in this case, I'm changing the contents of the table cells); tap-and-hold slides up a picker.
Another possibility would be to arrange your different forms on pages in a scroll view with a page control at the bottom, à la Weather. The best option, though, if you’re going to have a particularly long list and want to keep your screen real estate, is probably the FB/Path-style sidebar table.
I ended up using a UIActionSheet but I think it in other situations would be more stylish to use a controller like the IIViewDeckController.
I have a UITabBarController displaying a number of settings-screens in my app. I want them to be shown on just a part of the screen for layout reasons. In fullscreen, the lists become unreadable (too wide), there are just a few controls per page making the page feel very empty, and the tabbar buttons are far away from the content (Fitts law).
Using presentModalViewController with the UIModalPresentationFormSheet style gives me the size I want. I do this on top of an empty background, since in my case it doesn't make sense to display anything behind it. The "real" working area is displayed with another presentModalViewController in fullscreen mode on top of it all.
This works but feels like a hack. One problem is, I can't make the background behind the settings dialog move in the transition to fullscreen with the UIModalTransitionStyleFlipHorizontal style.
TL;DR
Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.
Can I embed a UITabBarController non-fullscreen in another "background"-view? I can't find any information of how I would do this.
Why don't you try it out?
Create a container view of the size you want the tab bar controller to have.
Create the tab bar controller.
[containerView addSubview:tabBarController.view];
I am using code from http://osmorphis.blogspot.com/2009/05/multiple-buttons-on-navigation-bar.html to implement multiple buttons in the navigation bar.
The huge problem I have now is that this construction "leaks" into the main window. By this I mean that if I press (up to about 15px) below the navigation bar the buttons still respond. How can I fix this?
Or does someone have a better way to implement multiple buttons?
It seems likely that your button bounds are extending beyond the navbar bounds. You can confirm this by setting the color of the button to something other than clear. To fix this you can either fix the frame of the buttons, or make sure clipsToBounds property of the containing view is set to YES.