Margin on Master View Controller on iPhone only - ios

I have created a Master/Detail app not using the Apple Default's Template but by simply clearing the storyboard and dragging a split view controller to there.
I select the split view controller and configure it like this:
The table view controller cell inside the master has only one image view that is 240x180 points.
This image view is configured to have the Content View width and height and be centered.
When I run this project this is how I see the master view controller
On the iPad
On the iPhone
for some reason on the iPhone version the image is not filling the whole cell and is shifted to the right.
This red band is the color when the cell is selected.

I love how these APIs do not work consistently across devices.
The same Table View Controller, the same project, shows differently on iPhone and iPad.
The red rectangle is the selected background view, that I have set to red, so when the cell is selected a red rectangle shows around. The problem is that there is an old iOS bug that makes the selection background view to cover the cell content partially.
Apparently the bug happens on the iPhone, but not the iPad.
To solve the problem, turn OFF this Insets To Safe Area on the Size Inspector of the Table View. This is turned on by default when you create the table.

Related

Gray bar visible on iPhoneXS throughout app

Header image with gray bar on top
I am converting our app to fit correctly on newer iOS devices. We are using xib files for the UI. I added a launch screen storyboard to start off the new formatting. I noticed a gray bar across the top of every screen. It is not part of the view controller and I've tried removing the status bar but that only makes the text and icons disappear. I don't think it's the navigation bar either since we have that hidden as well. I have checked the Safe Area Layouts.
Any ideas on what this is and how I can remove it to extend my view all the way to the top? The blue in the image is the color I currently set the background of my view controller and we have a custom header view below that.
Using the View Hierarchy, as suggested, I was able to see the view behind my main view. I inspected the code for that initial view and found the previous developers had offset the Navigation Controller by 20. That is what created the bar on all the views. I have adjusted to remove the offset and it looks perfect now.

UITextView disappears from ViewController

I have the strangest thing happening. My Text Views and Image Views randomly become invisible on my View Controller.
I am developing using Xcode 6 on OSX 10.9
I have a View Controller that is wrapped in navigation controller.
In the middle of the View Controller I have Text View. When I add an Image View or move controls somehow the Text View disappears. It doesn't re-appear at run time. There doesn't seem to be overlap as far as I can find. On the left hand side the navigation shows that the text view is there and I can select it and edit properties.
Has anyone seen anything like this?
I recommend upgrading to Xcode 6, and using its new view debugging feature to locate your view. The issue could be with incorrect Auto Layout constraints, or some views overlapping one another, etc.

iOS7 - unable to embed a screen in a scrollview

I have a screen that doesn't fit into a 3.5 inch phone screen. In iOS 6 I had the contents of the screen in a scroll view, but in iOS 7 that option is constantly grayed out.
Here is the screen shot
Would anyone know how to add the scrolling to my screen in ios 7?
Thank you!
Second screen shot with the scroll view.
Rather than selecting the entire view controller, you need to have a view selected. The options in Editor -> Embed In are contextual and since you have then entire view controller selected, your only options are to embed the whole VC within a Navigation Controller or a Tab Bar Controller.
If you can't get the right selection by clicking within Interface Builder, try expanding the outline view and selecting your view. Then try to embed your view within a scrollview.
Note that your root view must be a UIView, so you won't be able to embed the root view in a scrollview because that would put a scroll view at the root.
Three problems I ran into that I hope can help:
1) Make sure "Safe Area", or other object that shouldn't be there, isn't one of the objects selected in your view while trying to embed. For a simple test select just one simple object like a textfield or label and see if the Editor -> Embed In is still greyed out and work backwards if you have to.
2) You're going from View > Content to View > ScrollView > View > Content. So after embedding in a scrollview, embed in a view.
3) Once embedded make sure your scrollview is less than your content size, or it won't scroll: https://stackoverflow.com/a/28146729/1323357

Creating a custom tab view, with each tab containing a scrollview

Im trying to create an inventory page in an ios game. My design is to lock the view to landscape, then use half the screen for the "bag" or inventory (this is the tabs). The other half would be a display for details + menu controls
By selecting each tab, the corresponding view should be brought to the front of the view. Each view contains a scroll view and a static background image. The image is slightly bigger than the scroll layer since the image carries a border.
Since i only want a partial part of the view to be a tab view, i cant really take advantage of uitabbarcontroller.
Any ideas?

Toolbar hiding on rotated UISplitView DetailView

I've based my app on Apple's SplitView project type. I have a TableView as the Master, and am using different types of views as the Detail view. To select types of detail view, I'm using the fancy concept of buttons on my DetailView toolbar. When the DetailView is derived from UIViewController, everything is good. When the DetailView derives from UIViewController, but contains a UITableView then I have problems. In portrait view the toolbar is visible. In landscape mode the toolbar is hidden, even though the Tableview is moved down to allow space for it. The UIToolbar and UITableView are both defined in my NIB file which is loaded to create the detail view. Why is my toolbar invisible in landscape?
BTW, is this the best way to choose Detail view types with UISplitView? Bonus question, what if selecting a row in my DetailView tableview should bring up another View, I can't push it like I would with a NaviagtionController, so how do I go back to the detail tableview?
Thanks, Gerry
HI Gerry,
I have faced the same toolbar problem, when trying to rotate the splitView, toolbar will disappear. If you are creating the toolbar in the interface builder, try to set the toolbar properties(size), by selecting the toolbar, then --> Tools -->Size inspector, in the autosizing section, mark the left, right and upper red lines and unmark the bottom red line, then everything will works fine.
-Maria
Bonus question, I would create a UINavigationController in code, set it's rootcontroller to the DetailView tableview (self) and then push the new view on top of it.
When you react to the rotation change are you using the same view or a different one for the detail view? Seems like the new view may not contain an instance of the toolbar? Or the Tableview is covering it up because the landscape view has less vertical room than the portrait view. Are you resetting the height of the tableview to allow space for the toolbar within the 768 height when rotating to landscape?
Just a tip but whenever I run into odd things like this I remove the elements from the NIB file and create them programmatically in code and it usually solves the problem. You get a lot more control over things when you do. Overall as I've gained more experience with programming for iPhone OS I've found that I rarely put much into a NIB file any longer and do almost everything in code now.

Resources