In my Xcode4 projects I was using the Interface Builder to add scrollviews to my xibs.
After that I could drag other buttons or views into that scrollview so that they
appeared as expected when the app started. Strangely after switching to Mavericks and Xcode5 neither the buttons nor views appear after dragging them onto the scrollview in IB. So without changes from my side the projects using scrollviews don't work correctly anymore. Before starting the app everything looks the same. In the IB Document-Outline they are shown after Clip-View. Like this: ->scrollview ->clipview ->nsview_iwant_to_add. The buttons and views are shown in the IB preview.
Anyone an idea? Should be easy to reproduce. Just drag a scrollview to a xib and drag another (colored)view/button onto that scrollview to see they're not appearing in the running application.
Solved this by adding constraints to the elements put in nsscrollview. min. width height. etc.
The problem seems to be related to the way autolayout treats objects inside the scrollview.
Related
I added a UIToolbar on the bottom a view controller in IB.
I added a few UIBarButtonItems, but it seems to randomly resize either when I click on one of the UIBarButtons or if I leave the view and come back to it.
Is there any reason why it is doing this? I didn't have this issue when I was running iOS6, but on iOS7, xCode 5 the words shrink and expand randomly.
Is there anyway to lock the size or fix this issue?
Thanks!
I am in the process of transitioning an app to iOS7. All of the views throughout the app have a 44px empty space at the bottom that appears to be for a bottom toolbar or something, but I am not trying to display a bottom toolbar. This space also exists on views that do have a bottom toolbar and the toolbar just shows directly above it.
The red space shown is actually a view behind the black view. No matter what size I set the frame of the black view to, the red space is always shown. I am also hiding the status bar in plist, so don't know if this is an artifact from that or if it has something to do with navigation bar as they are both normally 44px in height.
I have looked at the transitioning guide and haven't found anything that's worked. Any ideas to what could be causing this and how to fix?
UPDATE:
I have tried setting edgesForExtendedLayout = UIRectEdgeAll and extendedLayoutIncludesOpaqueBars = YES (also tried NO) with no effect. When I look at the subviews of the navigation controller it shows a UIToolBar as hidden, but shows it contains a frame in the exact area the view refuses to resize to even with autolayout constraints.
UPDATE 2:
This is actually a problem with ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets it's center view bounds.
I believe it has to do with the UINavigationBar. Try toggling the following options in Storyboard and see if it solves the problem. Namely, the 'Extend Edges' options:
These options can also be set in code with the edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars properties on UIViewController.
If you are transitioning to iOS 7, you should be using an Auto Layout constraint to anchor to the Bottom Layout guide. Control drag from your view to the Bottom Layout guide and choose Vertical Space from the popup menu.
Using frames in iOS 7 is harder and is the way of the past.
Auto Layout is hard to grasp at first, but it is very powerful once you get the feel.
This is actually a problem with third party library ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets centerViewBounds for IIViewDeckControllerIntegrated. I was able to figure it out after changing to IIViewDeckControllerContained and seeing the view sized correctly.
In IIViewDeckController.m, just return self.referenceBounds for iOS7 like it does for IIViewDeckControllerContained.
I am trying to create the same type of slide-up/pull-up menu (from the bottom) as the Any.do iPhone app, but not having any success.
The issue I am running into is the app was built with storyboards so I am thinking I might have to scratch that idea and use just code.
Any ideas?
There is no need to get rid of your storyboard to recreate this, that's what IBOutlets are for. Any way, it looks like this was made by creating a UIScrollView that takes up the entire screen. Then add a UITableView to the upper section of the scroll view. Mind you in order for this to work, you'll need to disable scrolling on the scroll view in the background.
From there you can programmatically add the other elements to the scroll view to be rendered off screen, since there are only three they can probably just be buttons. And finally, since scrolling is disabled on the background scroll view you can add an image with a UISwipeGestureRecognizer at the bottom of the screen to manually change the scroll view's content offset property.
I have a UIScrollView with a bunch of buttons and switches present in it. When pressing any of these items the scroll view bounces to the top of the screen. While debugging this issue I increased the content size of the scroll view to be much larger than the space that I require and the issue does not happen. I should also mention that in in the hierarchy of objects within this view controller I do not have a UIView is it possible this could be causing my problem. I have tried adding a one in but it seems to break a lot of the UIScrollView features. Does anyone have any ideas as to why this is happening or what hierarchy structure should be employed when using a UIScrollView.
Thanks.
I'm trying to make and iOS app with both portrait and landscape views, but if I open it and change the orientation to Landscape, some buttons got offscreen, after going to IB and reordering the buttons, in Portrait they go off screen.
After googling, I dont have ANY ideia how to 'change' views according to orientation.
Could you guys give me some help?
Ah, also, Apple Support Documents seems pretty useless to me :P
Thanks!
There a method - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{}
which is useful in such cases.
You should change autosizing properties in IB (they're in the same place where frame size is) or change autoresizingMask properties of your inner views and controls programmatically. This controls what happens to the elements of your screen after it gets resized (for example when the screen is rotating). You can glue your components to left or right or both, top or bottom or both and similar. Play with it, it's pretty powerful and you don't need any code for that if what they can do is enough.