why storyboard ui elements not showing on UIViewController in xcode 6? - ios

I am new to IOS development. I am developing an app for IOS 8 devices. I used storyboard for my design yesterday my storyboard showing all UI design but today morning it show blank UIViewController no UI element vision please see in screen shot and very strange thing is that when i run my app all ui element visible in my device. I google but dont find any solution please help me out. Thank you in advance.

It looks to me like you are using size class and you went into a particular size class and added these views. Now you are back in Any size class, so the views are not there (that is why they are greyed out in the document outline at the left). They are available only for that particular size class. If you switch back to it again, whatever it was, you will see them again. Basically, you have created conditional views - the condition being that they are present only when that particular size class situation is the case.
In other words, if you want your layout to apply in the general case, you want to start by creating and editing it under Any size classes. Only then do you switch to a particular size class and modify the layout for that particular size class.
when i run my app all ui element visible in my device
Yes, because on your device the particular size class situation matches the size class you were editing when you added those views. So there they are. That seems to me to prove my guess is right.

I have the same issue while copy a ViewController to another storyboard.
Fixed by following steps:
1: Select the viewController
2: Click on 5th Tab
3: Set the simulated size to Fixed.

Select install:
Since all components [like label,textfield,buttons] are in disable mode, one select Installed check mark its will be enable again adjust constrain accordingly.

The size must be the same, in all xcode storyboard

In my case, it was due to me setting alpha to 0.0 and forgetting it.

Related

Custom class not automatically showing up - Swift 3 iOS 10.2 Xcode 8

So I have my app set up with two view controllers. The first one is my initiation screen, where the app starts, and the second is one the user can navigate to. I added the second one later on in my development, but when I went to the right column under the identity inspector, my new Cocoa Touch Class file is not populated for me to select. Now if you ask me to just type it in, I've tried that, it does not seem to connect. I've tested it by printing a simple line in the viewDidLoad() of the new second class when it is loaded in the simulator, but nothing is printed. Any help would be greatly appreciated!! Thanks!
EDIT
Easy fix is:
Select the activity indicator on storyboard and go to identity inspector and copy the object id. as image: ObjectID_ActivityIndicator
Right click the storyboard file which has the view controller you are working at.
Open as > Source Code
Press command + F to find and look for the id you copied previously
Paste this: customClass="yourclassname" customModule="moduleNAme" customModuleProvider="target"(don't change this target word, you can choose desired module from identity inspector if any).
Command + S to save it and again right click on storyboard file > openAs> Interface builder
Now select activity indicator again and go to identity inspector. You will now see it there. You can also change it as per requirement.
Enjoy. I faced this problem today and found no help online. My class and module field were greyed out. Tried this fix and it worked.
Note: Make sure your custom class is accessible and is in app directory i.e it's not highlighted in red color but gives a normal look.
I have seen a problem like this where the solution was to change the "Module" to a specific value, close the storyboard, reopen it and delete the "Module" setting (assuming it was originally blank or restore it to its original value). This happened in project with many targets and their names may have changed.

"Any" size class missing in Xcode 8

I'm a little confused when seeing the new interface builder's size class options in Xcode 8 beta. I used to build my apps' UI by first design them in "Any" size class and then do some custom adjustments in the other ones. Is the workflow supposed to be changed in this new version of Xcode?
The UI to select the size classes has changed in xcode 8. Now it is as follows:
Any constraints that you add without selecting Vary for Traits options will be considered as for all the size classes( Any Any previously)
To add a constraint to a specific size class add it by selecting:
The device at the bottom and by selecting Vary for Traits
options of that size class.
When you are adding constraints to a specific size class the bar
turns blue as below
The way to do this has changed slightly in the new version of Xcode. It should build for "any-any" automatically. Have a look at this WWDC video that I think explains it in detail. There is also a part 2, so watch that if you need to.
https://developer.apple.com/videos/play/wwdc2016/222/
Hope I could help,
Zack
To convert from the old Any by Any to the new Trait layout, go through each of your View Controllers and update all frames.

Font size change section footer table view

I'm currently building an iOS App in Swift and I got some problems. My settings view is a tableviewcontroller. It's a grouped one. My Table View is dynamic, fonts are dynamics.
I would like to interact to the change of font size from the settings app.
If my application was already running, the font size change but the layout is just broken. (change from the smallest to the biggest font)
Image : Layout bug
If I restart my app with the new font settings, there is no problems...
Here is a XCODE project example, you'll see the bug.
Could you please help me to find a solution ? Thanks.
The UIContentSizeCategoryDidChangeNotification is what you're looking for.
Per the docs:
Posted when the user changes the preferred content size setting.
This notification is sent when the value in the
preferredContentSizeCategory property changes. The userInfo dictionary
of the notification contains the UIContentSizeCategoryNewValueKey key,
which reflects the new setting.
Example callback implementation:
func handleContentSizeCategoryDidChangeNotification(notification: NSNotification) {
self.questionLabel.font = UIFont.preferredFontForTextStyle(UIFontTextStyleBody)
}
After you change the font size try to call
self.view.setNeedsLayout()
it sets a flag in the UIView that marks it as needing layout change.
Also you can try to call
self.view.layoutIfNeeded()
Apple documentation says :
Use this method to force the layout of subviews before drawing. Using the view that receives the message as the root view, this method lays out the view subtree starting at the root.
Hope that help you
Finally, I found that it's an iOS bug. I find the same bug in the Apple Apps.
The bug happens when you set the smallest font, quit the app and set the biggest font.
Thanks for your help.
Bug Settings App

Main.Storyboard Frames Not Updated

I am currently making an app which I plan to submit to the iOS App Store. Normally, when I update my frames in the Main.Storyboard of Xcode, it stays like that. However, now it does not. Whenever I close the app and reopen it later, the frames are not updated. It looks like this:
After I update the frames, it looks like this (what I want it to look like):
The app still looks fine when I run it on the simulator, but I still have 16 warnings in my app. I would like to remove these bugs as (I previously mentioned) I am submitting this app to the iOS App Store. How can I fix this? Thanks.
1)As it showing you have designed the layout in size class width-COMPACT & height-ANY. If you design your storyboard in size class width-ANY & height-ANY it will solve your problem.IT also happened with me.I have changed the size class & updated constraints of all ViewControllers.
2)It now shows a blank view controller. However, You will not get any warnings
3) Now You can make it visible by changing size class of the views inside the controller
select the view ->go to attribute inspector->go to bottom-> select installed & delete earlier selected size class
4)Do it for all views & update the constraints

Xcode 7.1: UILabel added to sizeclass regular/regular shown anywhere

In Xcode 7, I was able to add a UILabel only to the Regular/Regular size-class. I simply selected w: Regular h:Regular below the storyboard and added it to my controller using drag 'n' drop. Once I switched to another size-class, the element was shown as inactive in the document outline on the left. Everything fine.
Now the same approach doesn't seem to work. When I switch to another size-class after the label was added to regular/regular, the UILabel is still active in the document outline and shown when the app is running (on an iPhone for example).
Any pointers or hints more than appreciated! Release notes don't offer any clue. Doesn't look like a wanted behaviour that was mentioned anywhere.

Resources