I am started to learn iOS. I am doing small app. In that I placed UIPickerView and UIButton in ViewController. On view controller tap, UIPickerView will show to the user. On showing, the detail, UIButton also show (overlay on UIPickerView). How can I Put the UIButton back to viewController.
How to avoid inappropriate view.?
See the update button in UIPicker view
this depends on the order you add your subviews to your view. try [viewController.view sendSubviewToBack: yourButton]
in interface builder drag the view you want to place on top of your view hierarchie to the bottom. on the picture UISegmentedControl would overlap the UIButton if not properly aligned.
Go to your xib file and drag your Picker object to the bottom of its container as in the image below:
Related
when I'm unwinding a segue by clicking on a button with a cross image which is 1/4th inside a UIView and 3/4th outside the UIView now when I press on button the part which is inside the UIView then unwind segue works but if I click outside of UIView then it does not works.
As you can see from above image if I click inside the blue line then other view controller opens and If I click outside blue line of cross button the unwinding of segue does't work, why?
You can View the Video
<img src="https://i.imgflip.com/24bh0k.gif" title="made at imgflip.com"/>
The cross button seems to be inside the card view rather than superview. Put the button inside superview, over the card view but outside the card view.
Do something like this
take the button up on the view and set its constraints properly . May be your problem will resolved.
I want to move the navigation controller bar to the bottom of the view controller. How can i get this done ?
I tried :
self.navigationController!.navigationBar.frame = CGRectMake(
0,
UIScreen.mainScreen().bounds.height - 50,
UIScreen.mainScreen().bounds.width,
50)
This is moving to the bottom but hiding all other controller objects and also back button is not woking.
Sujay U N,
You should not try to move the UINavigationBar provided by the embeded UINavigationController to the bottom of the screen. Trying that will obvisoulsy move all the view's below it causing all the controller objects to hide.
Workaround
Approach 1:
Consider using ToolBar :)
Toolbar is designed to be placed at the bottom of the screen. If you are using xib or storyboard you can pick toolbar from components library and place it on your ViewController's bottom and then apply autoresizing masks or constraints properly :)
Now in order to show the back button make use of UIBarButtonItems. Change the style to custom and provide it arrow image or provide default style as done.
Though now you are all set to go :) You will notice UINavigationBar at the top of your view controller. In order to get rid of it,
select your ViewController, select its TopBar property set it to none :)
Approach 2
Use UINavigationBar.
Specific about using Navigation bar and dont want to use toolbar, well you can do the same thing with UINavigationBar as well.
Drag the UINavigationBar from components library place it at the bottom of the screen. Drag the UIBarButtonItem drop it as leftBarButtonItem, change the barButtonItem image to your back image. ( Same process as UIToolBar just use UINavigationBar instead)
Understand this is not same as the navigation bar provided by the embeded NavigationController. So get rid of NavigationBar at the top of your ViewController same as I explained above here as well
Finally,
In both the cases, draw an IBoutlet from barbutton item and handle poping the viewController programmatically.
Happy coding :)
I want to add UITextField and Button as this picture. I think that its position is fixed and It will scroll up when keyboard appeared. I'm wondering it's kind of tableFooterView or what else?
This is a UITextField input accessory view.
It has nothing to do with UITabBar or table view, just a plain old UIView put on top of each and every other view.
When UITextField on the view becomes firstResponder, you should put it over the keyboard and vice a versa.
UITableViewFooter is not an option here - at least look at Facebook or Instagram, it's done differently there.
I'd like to add a UIButton in a fixed position on my view, over my UITableView. I'm using a UITableViewController and Storyboard.
In the image below, the black square with the white triangle is static; i.e. it always remains in that position no matter where you scroll to with the UITableView. How can I replicate this?
You can create a UIViewController and add your UITableview onto that controller's view, then you can add your button as a subview of that controller's view above the UITableview.
I am trying to storyboard a fairly basic app. It has a tableview with some group cells. One of those groups I want to be a 'Clear' button with a red gradient background. Look at email settings, for an individual account there is a 'Delete Account' button that is a red gradient. What is the correct to add this to a table view when using storyboard.
What I have tried:
1.Just a normal table cell. This is not really a button although I could listen for a select on that cell.
Change the cell to custom, and add a button to the table cell. I have to change the button to a custom button to get the border to hide.
Add a button to the bottom of the table view. Issue here is that the button is wider than all the table cells.
Is there an easy way, or at least a right way to get a button that is the same size as all my table cells with a red gradient?
Added a screen shot of an example for the mail settings panel.
Drag and drop a view to bottom of your tableview, then drag and drop a button inside of that view.
You can resize that button like any other button, in button settings just choose your image file for the background of the button
EDIT::::
If you want them to be same background connect your view to a outlet and change the backgorund to same color:
#property (nonatomic, weak) IBOutlet UIView *lowerView;
#synthesize lowerView;
- (void)viewDidLoad
{
self.tableView.backgroundColor=nil;
self.lowerView.backgroundColor=nil;
}