UISegmentedControl custom background image - objective-c

I have UINavigationBar setup as image - some wood texture. I want to insert UISegmentedControl with 4 buttons on that bar. Buttons should have same texture with slightly changed tint.
One solution would be to change tint alpha of buttons background color, so that texture in background can get trough, but as I set alpha for tint in IB it doesn't save value, it always gets back to value 1.
I cant get UISegmentedControl to show background image, so finally gave up and decide to search for help...
Effect that is desired is one in iBooks app, with buttons in Navigation Bar.
Any link or small help would be appreciated..

This post describes the steps involved and has sample code: http://idevrecipes.com/2010/12/13/wooduinavigation/

https://github.com/xhan/PlutoLand/blob/master/PlutoLand/UI/PLSegmentView.h
a custom SegmentView that can specify two images(normal, clicked)

Do not bother with one of those custom segmented control packages if you're on iOS 5 or later.
Per Dylan's suggestion, use the Appearance functionality in iOS 5+.
See the top answer here:
Customizing Left & Right UISegmentedControl Buttons

Related

uibutton on top of image view not aligning

I have a UIViewController which contains a UIImageView, and I put a UIButton on top of the UIImageView.
I am using size classes (width compact, high regular, all iphones portrait).
When I add constraints to the button, it changes positions on different iPhone screens.
I have checked a lot of size class tutorials, but all of them are like putting button in the centre, or adding multiple buttons then evenly spread out.
Do anyone know any tutorial like adding only one button to the screen, and the button remains at the same position according to the background image?
Settings:
settings
Storyboard at design time
TBC
Remove Use Size Classes and Use AutoLayout and then change the view gaps from the column next to attributes inspector
This way you can have constraints and same location on all devices

Create iOS 7 UIButton With Text And Image Using Autolayout

Using Autolayout and Interface Builder with the target device being iOS 7 iPhones, how do I create three of these kind of UIButtons that have an image, a divider line and text? The 3 images for each of the buttons all have the same size. The lines and text in one button must line up with the other buttons' line and text (left align the text). Things can't go crazy if the phone is turned to landscape. All buttons are the same constant size.
The buttons are part of a home screen layout which has a logo at the top and so on. When one taps one of the buttons, the app does something.
One thought was to create a button with no text, put a label on top, a thin view for the line on top, and the uiimageview on top. Maybe explicit layout constraints are not even needed? Maybe a containing view is needed for the "button" contents to keep the "button" pieces together?
Image+text can be achieved using UIButton only without adding any autolayout constraints. You set both image and text using -setImage:forState and -setTitle:forState:, and then adjust button insets using *Insets properties. To set the insets properly, play with this great test project: https://github.com/jrturton/ButtonInsets (it's not quite clear from the docs how to use them simultaneously, and this test app should give you the idea).
As for the separator, I'd recommend adding it directly to your images.
But if you don't want to stick to the UIButton and its insets, you can subclass UIView, add 2 UIImageViews (the actual image and the separator), a UILabel, and throw in a couple of constraints. To make the view clickable, you attach a UITapGestureRecognizer to it.

Remove UITabBar horizontal separator in iOS7

I want to remove the horizontal separator line between a UITabBar and the rest of the screen. I'm asking the same question as this guy but updated for iOS7.
Setting the background image of my UITabBar doesn't alleviate the problem, nor does setting the background image of the [UITabBar appearance] object.
Is this still possible in iOS7? If so, how?
You could also hide shadow line using this code:
[self.tabBar setValue:#(YES) forKeyPath:#"_hidesShadow"];
Swift
self.tabBar.setValue(true, forKey: "_hidesShadow")
The answer to this is pretty much the same as removing the separator of a navigation bar or a toolbar.
Officially, this is only possible by setting the shadowImage to an empty image. However, a closer look at the documentation, we see that:
For a custom shadow image to be shown, a custom background image must
also be set using the backgroundImage property. If the default
background image is used, then the default shadow image will be used
regardless of the value of this property.
By using a custom background image, you would lose the blurred background translucency.
The separator is a UIImageView that is a subview of the tab bar. You can find it in the tab bar's hierarchy and set it to hidden.
This solution uses a transparent image, so it is more preferable.
Swift
tabBar.shadowImage = UIImage()
Objective-C
tabBar.shadowImage = UIImage.new;

How to put background for UITableViewController

I wanna do something like THIS in my ipad application, what is the best way to do the followings:
The shadow under the upper bar.
The padding for the papers (top, left, right & bottom)
The background (as a notepad) : please think about the cells: they must still scrolled inside the paper and cropped before reaching to the paper bottom edge.
I'm looking for the optimal solution that avoids overriding as much as possible.
EDIT :
I tried to use UIViewController (with UITableVIew and has the delegate methods) inside UISplitViewController, And I tried adding UIImageView at the top of the table but this view will scroll with the cells and it'll hide when I scroll down. I tried to use viewForHeaderInSection function also for upper shadow (under the bar) but what about the papers bottom edge (what if I put one image including the shadow and the papers bottom edge and has the padding as a background for the UITableView or UITableViewController, and change this image when rotate to the portrait orientation? is this a good and possible solution?)
My guess:
Create the background in an image editing app
Cut 4 images, for header, footer, left and right sides
Create a UIViewController with 4 UIVIews and add the correct images as background
In the middle of all 4 add a UITableView
This way the images won't move and if you position the UIViews with the background properly, your TableView will scroll inside the notebook (assuming you are trying to create a notebook)
If you app is iOS 6.0 only, autolayout will be a great help. Check apple developer video on it to learn how to use this feature: WWDC 2012 Session 232 - Auto Layout by Example
One easy way to do this is from the xib:
1. In xib create image .On image view you can put background whatever you want as a image.
2. create table view above the image view and set table view background color as a clear color.
This will do it.

How can I add shiny surface to UITableView

How can I add shiny surface to UITableView
This is done easily. From the screenshot you supplied it appears that most of what you're pointing out is photoshopped images positioned with UI elements supplied from within Xcode and customized via code.
The tableView for example appears to be on a Grouped Table View laying on top of a photoshopped textured image. The tableView itself has a custom color to all the cells and a custom color and shadow to the cell separators. You can use Google to see how to customize a UITableView pretty easily.
But like said, most of this is from the magic of Photoshop.
Create your own views and photoshop them.