Because the navigationItem.rightBarButtomItem is customized, it will occupy a big place and the title view won't be on the center.
For example, I want the "OMG" is located at the center between buttoms of "Home" and "Group".
How to achieve this?
Change the rightBarButtonItem to Camera and Setting... and add Group Button as subview to the navigation bar.. do some trial and error to adjust the x position for the Group Button....
If you have fix titleView as "OMG" good.. if not then it will be little tricky to position the titleView with longer text but it can be done..
make the title part of the navigationItem.rightBarButtomItem, this seems to be the best way to make sure it is positioned correctly.
Related
I want to center an image and button to another button. I do not know how to do this. It would be appreciated if someone can show me through the storyboard interface and not code. Thanks
I tried selecting both and control dragging it to the button I want it to center with. However, it just center the button rather than both.
https://imagizer.imageshack.com/img923/2572/8M6NRu.png
As you can see, I want to center the lock image and already have an account button to the get started button.
You can't center a pair-of-views. So you need another view that does nothing but contain the lower lock-and-button, and now you can center that in respect to the upper button.
This use of an effectively invisible view just to make the layout constraints work correctly is extremely common, so don't hesitate.
You will need to pin the lower lock-and-button on all four sides to their superview, the new view that I'm talking about, in order to size the new view to fit them. Then you position the new view and you're all set.
In the storyboard:
In the running app:
I am having some slight issue and trying to fix it but can't find the easiest answer towards it. I have a navigation bar, which is taking top pixels away, and hence the webview content last 44 px if I am not wrong goes under the bounce and hides the content. Hence the problem is that I have a submit button, and since it needs to be clicked, it goes under the bounce condition and doesn't let me select the button. Any quick solution to this problem will be appreciate.
Thanks
Make sure your UIWebView has the autoresizingMask set to be flexible in height and width. You can do that in interface builder or in code.
You can set the bottom content insets to 44. But it seems your view is not put correctly (web view size does not take navigation bar into account, web view is not resized properly, etc.) I would fix that instead of patching with the insets fix.
First,I am sorry for my poor english...
So, i have a problem with a view which is added on a other one.
I am setting size of UIview in IB as 200px/200px
I set the center of this view with the center of parent view.
Everything is working great at this point.
I can see my View in the center of the parent view like i want.
Then I set the - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
And that's working to.
But when i rotate the iphone, the size of the view change to full size, the view don't want to stay in center and go on the top left of the screen and resize as fullscreen...
Can somebody help me with this problem ?
Do I have to set the frame and the center after rotate ? That can't be automatic ?
Thank you!
In IB, under the "Autosizing" section, remove the "arrow" that indicates auto width/height of your component.
OK, so I am learning to use UIScrollView in interface builder. since the scrollView itself does not have any content, I created another view, the contentView, to hold my controls and scrollable content. into this view I place controls, labels, etc and then in my code i set the contentSize of the scrollView to the size of this contentView.
My question seems stunningly simple and so obvious that I must have missed something somewhere. when I created this XIB in IB I got your standard empty iPhone interface window. I dropped a scrollView on top of it, it took up the whole window. I dropped a view on top of that, it took up the whole scrollview. I added some controls, which so far I can still see inside the contentView rectangle in IB.
My question is how do I work on/add controls which lie outside of the visible part of the contentView in IB? LOL. it seems so simple, but i just don't get it. I can set the height of the content view or drag the rectangle to whatever I like (and indeed this is the whole point of having a scrollview) but the fixed UI window from IB won't expand so i can see the "offscreen" part of the contentView to add more controls. It's like it's just fixed at that size because that's the size of one iPhone screen and it won't let me make it any bigger/taller.
what did I do wrong?
-a
You need to turn off all simulated user interface elements (like the status bar) to be "undefined" except for size, which you select to be "Freeform" from the drop-down, and then you can set the view height using the Ruler tab to be whatever you like.
For example, here I've selected a photo view controller, and set the size in the right side bar to be "iPad Full Screen" - but I could also change that to "freeform" to set any height I wished.
First add a ViewController by any which way you prefer. Then in interface builder, click on the view controller Icon (on left). In the connections inspector click on the ruler icon "Show the size inspector". There will be option list for simulated size, change to "Freeform" and increase the height to any size you want. Hope this helps.
neeever mind. you drag the content view up so that some controls are offscreen and then add more controls/expand to the part you just made visible by moving the top stuff off the top. in effect, you physically scroll the contentView in IB by dragging it with the mouse. seems a smidge counterintuitive, but whatever.
Set simulated size to freeform for the the view controller to a large enough size that you can add in your controls
You don't have to create a view to place inside the scrollview if you don't want. In your case, it sounds like it doesn't make much sense.
As for the second part of your question, you can place items directly on the scrollview (it is a view afterall), as subviews. If you want them to be off screen, then just set their frame up to be at those particular x, y coordinates you want it to be at. You will have to ensure your scrollview's contentSize property is large enough though to house your entire content, this is what allows scrolling horizontally/vertically.
You probably want to do the offscreen elements programmaticly instead of using xibs.
I'm attempting to achieve a "drop down" menu effect with a UIPopover. When I change the height from 0px to 500px it appears to stretch 250px up and 250px down... essentially anchoring the UIPopover at the original spawn point on center. I would like the anchor to be the top of the popover, so that when I adjust the size it is the bottom of the window that animates downwards.
I've noticed this happens automatically if you move the UIPopover to the top the screen. But how can I achieve the same effect when it's displaying dead center?
Try to use:
presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
or
presentPopoverFromRect:inView:permittedArrowDirections:animated:
and try UIPopoverArrowDirectionUp as permittedArrowDirection
arrowDirections
The arrow directions the popover is permitted to use. You can use this value to force the popover to be positioned on a specific side of the rectangle. However, it is generally better to specify UIPopoverArrowDirectionAny and let the popover decide the best placement. You must not specify UIPopoverArrowDirectionUnknown for this parameter.
What about creating your own popover? I mean, something that looks like the original popover but has the behavior you want.