I have seen the many threads on dealing with the iPhone 5 screen, and I have a Default-568h#2x.png added. The top view of my App resizes accordingly, but I have a container that contains a UITableViewController with static cells that gets more cells added when run on the iPhone 5. I need to have the static cells resize along with the rest of the app, so they occupy the same screen area.
Storyboard lets you toggle between 3.5 and 4 inch layout, but the changes you make carry over to the other, unlike when you rotate the view to adjust layout for screen rotation....
I found a lot about adding a second storyboard for the 5, but this seems like an inefficient way to do it. Is there any other way to get the static cells to resize accordingly? Thank you much!
Set rowHeight of your tableView to self.tableView.frame.size.height / 5
Related
I have some issues when i launch my swift application on ipad simulator. I have a home view witch displays 5 images. In my storyboard i have set for all of those constraints for height, width and also spacing. The problem is that when my app is running from ipad , the photo on the middle is situated over the other ones and the spacing is not as i expected.
What i want is a way i can make the same space value between images for each screen size and that the images will resize themselves in order to respect the initial view. Any piece of advice is more than welcome !^.^
Remove width and height constraints for your image views and add equal width and equal height constraints to them. Check out "Auto Layout Tutorial" section "Fixing the width" to see how to set equal width between views. I recommend you to read it whole :)
Nikita is right.
I can add: often apps evolve, so you will add another image.. far better to pass to a CollectionView where every CollectionViewCell owns an image.
In this way:
1) you can decide layout very precisely (with constraints in InterfaceBuilder, or form code using NSCollectionViewFlowLayout delegate methods..)
2) You can manage rotation easily
3) You can scale for iPhone..
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'm making an app for iphone. My layout can be the same for iphone 4, 4s, and 5 but for the iphone 4 and 4s the only thing that change is space between buttons. I finished my app and i arrange all storyboard to run well on iphone 5. Now i only have to tell that when the app running on iphone 4 and 4s i have to change the space between the buttons in some views to get all buttons inside screen. How i can do this? I can use auto layout i think but i dont use this. Its possible to help me? I do the things right, doing the design first for iphone 5 and now adapt for iphone 4 or im doing the things in the wrong way.
Regards
The IOS6 autolayout it's still a bit "wild" and it will also disable the IOS5 compatibility.
If you don't use autolayout, you can still set some rules in storyboard at size inspector, like tide you buttons to the top or the bottom of the view, so you can control where they go when the screen shrinks.
A better way is to add subviews to your view, and allow the subviews to shrink and expand (also # size inspector in storyboard). Then add your buttons to those subviews, tide them to the top, bottom, or let them untied/free if they are placed symmetrically inside the subview.
You can simulate quickly with the form factor button in storyboard (right-down corner) to see where the buttons go when you switch the sizes.
These methods require zero lines of code, but more work with the storyboard.
I understand that Apple will do a kind of autoresizing thing when iPad / iPhone change orientation and you can set views' autoresizing masks.
But what if the views' resizing is not that simple?
for example, I have a TableView and each cell has different number of letters. Assuming in Landscape mode, the TableView has perfectly built so that the TableView does not need to scroll down and all cells are listed perfectly ( I calculate the right font size for the texts in each cell depending on the width info)
If now I change the orientation to Portrait, yes, the TableView is narrowed, and the cells are messed up, they are narrowed (of course I want), but the TableView need to scroll down to see all cells. I know know the font sizes should be smaller so cells can be shorter
My question is:
So I have recalculate all font sizes if the orientation is changed? If I have 20 such TableViews laid in a paging-enabled ScrollView, I have to do this for all 20 * 10 cells each time when the user change the orientation??
Thanks
The answer is YES, either you need to create a two view OR change the existing controllers frame. This is the only way to handle orientations.
Can Anyone tell me how to slide textview in iphone in the same manner as we do with images.
I am developing an application in which I want to side the TextView. I have 5 TextViews.
Can anyone help me with this.....
Thanx in advance...
You'll want a UIScrollView with paging enabled. Since with paging the view "stops on multiples of the view bounds" (according to the docs), you'd just line up your five text fields side-by-side, and make them the width of the visible area (the screen) inside a container view that sized to contain all 5.