IOS Tableview support all screens and Landscape screen - ios

I Was create a UIViewControler in storyboard or XIB with autolayout.
When i add UITableView into the view controller it does not support all screens properly even not support to portrait/landscape screens too.
I Have attached a screen of my story board.
I am a Beginner for iOS , so i dont know hoe to set constraints.
Please Some one suggest a best tutorial to done this or provide a simple sample application.
FYI: I am using Xcode 6.1 and Objective-C
Thank you!

It sounds like you're having trouble with adding constraints to a UIViewController.
Here is a good primer on AutoLayout on Ray Wenderlich's site. It's a good way to get your feet wet with AutoLayout in Interface Builder.
Once you do that, consider reading this article about why to not use Interface Builder. I was finally convinced by this article to go the pure-code route, and I've enjoyed the results.
Anyway, for your particular example, here are some screen shots to add the constraints to your UITableView:
When you add the UITableView to your UIViewController, you probably lined it up so that all edges between it and its containing view matched up. In that case, when you click the "TIE Fighter" button (really called the "Pin" button), you should see the following:
At this point, you simply need to click the 4 "struts" to add those constraints to your UITableView. When you do that, they'll turn from light gray to red, as seen here:
At that point, simply click the "Add 4 Constraints" button to finish the job. Your UITableView should now be "pinned" to all 4 edges, causing it to resize automatically during rotation.

Related

swift 4 and Xcode autoLayout and UIImageview as Button

I am working on auto layout and making those UIIMages as Button.
I would like to make those button to be clicked and switch the images
as well as showing some words in the label.
In this case what should I do?
In addition, as it is shown, the auto layout ratio is different only from the iPhone SE. In. this case What should I consider?
Many thanks,
The first thing you need to learn is auto layout. Start with basic Always go with Apple's doc first
This one I likes he is good and you will also find how to use buttons as image view, using card game example, check other tutorials also very helpfull.
Stanford university autolayout by Michel Deiman
As far, your question just gives your label Horizontal in the container constraints(open storyboard in the right bottom third from last (allin) click on it popUp will open), and 20 bottom to the buttons and it will be in the centre. Every elements need x,y height and width so it knows exactly where to place, so you also need to give constraints to the buttons, Learn stackView to understand how to place your button without giving many constraints to each button and stack view will handle it for you, try hide and show to one of the button and magically stack view will adjust all adjustment. I suggest before staring Do read apple's doc first.
And Your question is too broad to answer, so read and try adding different constraints based on your need and ask a specific question(after trying by yourself) like why this label getting cut what constraints should i add so people know exactly what you want to achieve, people are always ready to help, just ask the right question.
happyCoding

iOS Universal App Layout Issue

Please see the attached screenshots of the app running - as you can see there is an area at the bottom of the iPhone screen that is not used. The same area of the iPad detail is however. I know there must a bar somewhere I need to hide but I can't find anything amiss.
I have a UITabBar controller as my root VC, which has a tab that leads to the UISplitViewController. As far as I am aware, the UISplitViewController is being used in the standard form.
Can anybody point me in the right direction. I am not sure what information to post, so please ask if you need more info.
Thank you all for your help. In the end though, the solution was fairly simple! I checked the Extend Edges Under Top Bars and Under Bottom Bars options for the UISplitViewController and voila!]1
simple solution
open storyboard
select ur viewcontroller
change wAny hAny
preview ur viewcontroller in iPad/iPhone and all devices u needed
and rotate ur preview screen.
your How to solve this?
Review Debugging Tricks and Tips section of the Auto Layout Guide
Compare storyboard with actual results - does your storyboard contain the same issue (most lightly not).
Review the constraints you have set for the view in question.
Check your constraints for the size classes in view controller with the view in question.
Add an IBOutlet and instance variable for the bottom constraint of the view in question and set breakpoints. Implement any/all of the methods in the UIContentContainer protocol to see what is happening with the constraint and the current class size.
6.Implement - viewWillLayoutSubviews to see any frame changes.

What are the best practices in building user interface with Xcode?

I am designing a simple user interface for an app using Xcode and Auto Layout. I have a view controller with three basic outlets: a static image view, a label and a button. You can see it in the picture shown below.
As you can see, I'd like to have the image view horizontally and vertically centered in the view controller, the label just below it and the button somewhere in between the label and the Bottom Layout Guide.
The problem is that I am experiencing some appearance problem with the iPhone 6 I am using for testing. The interface items are not nicely centered as they are supposed to be, as you can see from this screenshot.
I am not asking for the solution to this problem, though. I would rather know whether there are best practices to design a good user interface. For example, is there some way to temporarily hide the label and the button from the view controller to focus only on the debugging of the image view without having to remove and redesign them again?
Select the label you want to hide,then uncheck the checkbox installed
You can simply set its alpha to zero .

Different iOS devices size programming approach

I am starting a new project which should be working on every iOS device size possible.
The project is rather simple. The main view will be a scroll view and it will hold a '+' button (where it says 'button' in the image) in the top right corner. (It does not really matter, I'm just trying to give the general idea of what I'm trying to understand and implement.)
A small example:
What is the right approach for this kind of problem?
Should I create a different storyboard for each device?
Should I start creating an adjustable scroll view that will hold the needed buttons with some constraints (if at all possible)?
I have read this tutorial:
auto layout
which explains the auto layout nicely, but does not mention the issue I'm trying to figure out.
Any thoughts?
Use AutoLayout and position your views relative to one another (so no x pixels spacing between views). Make only one storyboard for all devices, when a different view should be loaded on another device (like a completely different layout), select the appropriate size class and adapt the views and constraints.
Then it will be recalculated on every device.
The storyboard has a preview section where you can choose a device to simulate the view on.

UIViewController completely out of place on the screen

I am putting together a sample iPhone app for practice. It is a drill-down interface with doctors who have patients who have prescriptions and visits using Core Data and a story board.
Everything was going great until I started on the Edit/View doctor screen. Because this screen is triggered by a button in the UITableViewCell, it seemed that there was no way to create a segue on the story board to an edit/view screen because the buttons in the cells are dynamically created.
I decided to make a separate UIViewController custom class and I let Xcode generate the XIB for me to make sure I did not mess up anything. I presented the edit/view view controller by pushing onto the navigation controller. The problem is that the contents of the edit/view screen were nearly completely off the screen. With my first attempt, a navigation bar I put at the top appeared at the very bottom of the screen in the simulator with all of the rest of the text fields and labels not showing at all.
I then created another view controller with xib, specifying iPhone only and simply put a label with "Hello" in the center of the view. When I ran the simulator, "Hello" was centered vertically, but was all the way to the right of the screen with only "He" showing. I tried played with anything I could find to play with, but nothing fixes it. I am not trying to do anything unusual. I want to do everything in the usual accepted way.
Also, it seems like Interface Builder makes the views look like big square iPad screens even when I have specified iPhone. I did check the frame dimensions and it was wxh = 600x600.
Thank you for your help.
It occurred to me to search for 600x600 and it seems that this is the new UIView that Interface Builder provides by default. Because there are many screen sizes, Constraints are apparently mandatory now.
My edit/view form was completely fixed by viewing the XIB and going to:
Editor->Resolve Auto Layout Issues->Add Missing Constraints.

Resources