Hi there I have a UIView with a bunch of UITextfields. My problem is that my UITextfields are present from the top to the bottom of my screen. So when the keyboard pops up, it covers half the screen and consequently the UITextfields below...What can I do so that all the fields can be edited by simmply scrolling when the keyboard is visible?
You need to embed your UIView into a UIScrollView and then change the size of the UIScrollView when the keyboard pops up.
Just give the view a new transform that moves it up. Eg.
[myView setTransform:CGAffineTransformMakeTranslation(0, -keyboardSize.height)];
Thats also animatable, just give it the same animation values as the keyboards and it will look perfect.
This solution is from XCode 5, iOS 7.0 and Storyboards. It worked for me quite well.
http://www.youtube.com/watch?v=4oCWxHLBQ-A
Related
Hi I'm new to iphone programming and I'm having problem with scrolling on the storyboard. Let's say I need to add 30 buttons on a viewcontroller inside a scrollview, but the screen size only fits 15, how do I scroll down and add more buttons.
screen shot 1
Another problem I have is that when I run the iphone app on the simulator, it can only scroll down too the button 13 even though there are 15 buttons on my view controller.
screen shot 2
Thanks for your help.
you can scroll the scrollView on the storyboard. Scroll down and then add buttons.
You need to set a size appropriate for Scroll ContentSize. Take a note at that.
Please do provide more info from. Its gonna make the resolution process easy.
Take a look at this link for solid ScrollView intro:
http://www.raywenderlich.com/76436/use-uiscrollview-scroll-zoom-content-swift
In the storyboard... Just make the view bigger. In your case, you want to change the height:
For the problem of not being able to scroll across all your images. You need to make sure the scroll view is pinned to all four sides of the parent view and that the height and width are all set-up for the content inside the scroll view. (make sure there are no warnings associated with the scroll view in the storyboard.)
I am working on an app for iOS and I have to do a tab selection screen like the Google Chrome app for iPhone (I attached a screenshot). I searched a lot but I didn't found any similar control to use. As i can see, it groups some UIViews and use a UIScrollView to scroll, but maybe any of you could explain me better how this control works or have any solution.
Thank you!
http://i.stack.imgur.com/rCG5g.png
Create Different UIViews with your controls.(One tab is equal to is on UIView)
Add this UIView's on UIScroll View.(This is optional. It's ok if you don't use the UIScrollView and add UIView on self.view
Implement the touch method on UIView.
When you get a particular UIView is touched change it's center position to Center of the screen.
Which will give you the UIView which is touched in foreground and rest of the Views in background.
Hope this will help you .........
I solved my problem with this ......
https://github.com/xxhp/BrowserTabViewDemo
I need to know the logic of how to write this code.
This is my problem.
When a user taps a button, I need to show a UIToolBar (with a few buttons on it) on the view. This toolBar should appear ONLY above the UITabBarcontroller.
The view is a UIScrollView, so if I hardcode the position of the UIToolBar, it will be displayed in the wrong position each time the user scrolls (Hope you understand what I am saying).
I did the following. I hard coded the position of the UIToolBar (so it will place above the tab bar), and added it to the Window. This sounds like a good solution as the windows size will not change at all instance.
But, I don't want to add this to a Window. So is there any other way I could solve this problem?
I would add an additional UIView to the window so that it acts as a container for both the UIScrollView and UIToolbar. Then resize the scrollview so that it falls short of the toolbar.
You should be thinking of this as layers of views
I have a modal view with a textview and a button. When the keyboard is displayed it covers up some of my UI elements. I'd like my modal to be scrollable so that it can be viewed while the keyboard is displayed. How can I do this?
I've had the same question, and i've played with it a bit,
setting a UIScrollView is not enough, as in the inspector
you should 1st. increase it Hight, then in the attributes, check the following checkboxes:
Scrolling enabled, Bounce Scroll, always bounce vertically.
Edited: Forgot the most inportant thing:
in the size inspector, set the Buttom field (under content) to the size you wish, (960 is twice the regular size)
Use a UIScrollView instead of an ordinary UIView. You can disable scrolling when you don't want the user to be able to with:
[theView setScrollEnabled:NO];
Is it possible to resize the UITableView on the RootController of a nav based app? When RootViewController.xib is opened in IB, there isn't a view. Just the UITableView. Clicking the inspector and then the little yellow ruler, frame height is grayed out. I'm adding a toolbar programmatically to the RootViewController:
[toolbar setFrame:rectArea];
That works fine but the bottom cell in the tableview is partially hidden because the tableview doesn't know about the toolbar.
The easiest way, is to adjust the contentInset (which is inherited from UIScrollView). Resizing by setting the frame can cause crazy drawing bugs in cells.
For example, if you are trying to resize a tableview for the keyboard, do something like this:
tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 216.0, 0.0);
tableView.scrollIndicatorInsets = tableView.contentInset;
Hope that helps someone. This way worked best for me.
Yes, but you need to have a ViewController (not a UITableViewController) as the root controller for the nav, and wrap the actual UITableView in the UIViewControllers view.
You can still have the UIViewController conform to the UITableViewDelgate and Datasource protocols, and use all the same methods you have now in your UITableViewController.
P.S. you'll get more responses if you use the plain "iphone" tag.
You could also just set the Content and Scroller inset of the tableview
I encountered a similar issue when attempting to display the detail controller by itself, see: http://vimeo.com/13054813
The issue is that the SplitView controller applies its own transform to the sub-controllers, taking them out of the orientation detection loop, which blows goats and seems incredibly 'hackish' for built-in classes. (The video illustrates what happens when you make the detail view the root view, then add it back to the split view and make the split view root while in landscape; you get double rotation of the detail view.)
Unfortunately I've again run into these transformation issues while attempting to resize a SplitViewController's detail sub-view in response to the keyboard appearing/disappearing. In portrait, all works fine, in landscape it's fscked.
Yes, adjust the contentInset and scrollIndicatorInsets are the convenient way to resize the UITableView.
As the answer of Sam Soffes posted, I succeed resize UITableView in UITableViewController for the bottom UIToolbar.