Watch question
I am new to iOS development. I got a project to maintain, the problem is that I can't find where in the storyboard belongs the variable. For example, in my ViewControl there is such a line
...
#IBOutlet weak var imgBottomFade: UIImageView!
...
So, I need to find this UI view in the storyboard, I open storyboard, but I see there are more than 10 screens each of them pretty sophisticated, and I start to click on each view on the screen and check the name (equal to imgBottomFade), one view by another, one screen by another... pretty annoying, I believe in XCode should be kind of way to find out where the UI view connects from Controller to Storyboard.
Let me know what I missed?
What you could do:
-open both code file and storyboard
-zoom out to view the whole storyboard (25% or smaller scale factor)
move mouse over the black dot in front of IBOutlet
-observe carefully in storyboard: you should see the UIImageView highlighted
or
-search for imgBottomFade in the search bar (at the very top left)
-you will find at the end of the list a reference to Main
-click it
-that will position the storyboard on the relevant VC
-expand view in the left panel of storyboard
-you should easily find imgBottomFade in the list of objects.
or
-search ViewControl VC in storyboard (just 10 to inspect)
-select it and expand its view object in the left panel of storyboard.
-you should find imgBottomFade in the list of objects.
Related
In Xcode 7.3, when I drag in a Table View from the Object Library to the Storyboard for a single view app, it doesn't automatically expand to the full size of the view. I seen it do that in my Udacity class videos and in other videos on YouTube. Is there a setting in Xcode that will correct this? Thanks.
Yes, you need to "pin" the tableView at the ViewController. Am I right you have a simple ViewController and add a tableView to it?
Now, you need to open the Pin Menu and uncheck the checkbox "Constrains to margins". Now you add the constrains to the top, left, right and bottom to 0 and save it. Now the TableView should stretch the whole display.
If you only show a table in the ViewController you should use a UITableViewController.
i am currently working on a menu bar application for OS X. I want do display some data in a NSTableView within the menu. I already managed to set the view of the first NSMenuItem to my NSScrollView.
The problem is that i don't know how to set the maximum height for the NSScrollView. I want something similar to the Shazam or Adobe Creative Cloud app: A small menu with a TableView inside it that scrolls but doesn't fill the entire height of the screen.
Here is what i currently have:
The way it works now is that the menu automatically fills the entire screen depending on how much data i put into the TableView.
Here is a screenshot of the way the Shazam app does it:
They display lots of information inside the table but restricted the NScrollView to have a fixed height.
I don't think this is hard to do but i don't know where to look for the option.
Any help would be really appreciated :)
Regards,
Timo
I finally figured it out! I assigned the wrong view to the NSMenuItem.
Now i have two outlets inside my AppDelegate:
#IBOutlet weak var myMenuItem: NSMenuItem!
#IBOutlet weak var myScrollView: NSScrollView!
Inside applicationDidFinishLaunching() i assign the NSScrollView to the view property of the NSMenuItem:
func applicationDidFinishLaunching(aNotification: NSNotification) {
...
self.myMenuItem.view = myScrollView
...
}
The problem i used to have that i set the menu items view to the NSTableView directly, not to the NSScrollView. Everything works fine now.
Thats what the result is looking now:
Exactly what i wanted :)
Regards,
Timo
I currently have 3 tabs connected to a common UITabBarController. When one of the tabs is selected the user is taken to a UITableView with 3 cells which can be selected. When a cell is selected the user is taken to a new page with a UINavigationBar at the top. My understanding is that the UINavigationBar is supposed to include some sort of back button and I couldn't figure out how to enable it.
In place of the default back button, I dragged a UIButton to the corner and connected it to the 'Show Detail' property of the previous view but when I press the UIButton I am taken to the right UITableView but the tabs are missing for navigation. What am I doing wrong? My segues look like this:
The UINavigationController has the back functionality. How to go back one view in UINavigationController?.
Here is some old tutorial on how to combine that with a tabbarcontroller. should still be the same principles.
I have a reasonably complicated UIView which contains several nested views which are displayed according to a variety of responses - all are laid out in a storyboard.
Is there a way to hide a view in the foreground to work on a view in the background? As its really fiddly selecting particular elements to arrange / style!?
I've been trying to figure out a nice way to do this, some function like hiding the view and its subviews from the storyboard (not from the actual application), but couldn't find anything.
This is not the nicest of ways but it is how I do it at the moment...
What I do is select the views I want to "hide" from the document outline and add a constant (screen width/height) value to its x/y origin value to push them out of the screen. I also change the document label for those views (Identity Inspector > Document > Label) to something like "Hidden" so I can later search for the "hidden" views from the document outline and put them back where they belong.
I have 2 work arounds.
A) Change the View Controllers size to freeform. Set its size to be really large so I can space out the views.
B) Use the sort order of the views Document Outline (lowest is front most) and add an image view (same as the view background) under the first view to block the others. Then delete it after finishing my edits.
or xcode developers could just simple add a design-visible checkbox for views and controls.... but ill take my rants somewhere else.
In xcode 7 you can do it from the storybord
for more details
https://stackoverflow.com/a/25213491/4879683
Maybe this could help you :
Open your storyboard in the Finder and edit it with a simple text editor (not xcode).
You will see it's just a xml file.Look for the view you want to hide, and add hidden="YES" in the parameters list.
That's what I do on my own project.
In Xcode when you select your storyboard, you have a panel that displays all your view controllers and their hierarchy. If you change the order of the elements you change the background/foreground order.
You can add extra views to the scene dock.
These views get initiated along with the view controller, but are not added to the view controller's view hierarchy. You can reference them using IBOutlets.
e.g. I have a full screen loading view that I added to the scene dock instead of covering up the view controller in the storyboard. I can add the loading view to the view controller's view hierarchy in code:
#IBOutlet weak var loadingView: UIView!
...
loadingView.frame = view.bounds
loadingView.autoresizingMask = UIViewAutoresizing.FlexibleWidth.union(UIViewAutoresizing.FlexibleHeight)
view.addSubview(loadingView)
Reference: https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/Chapters/AddViewsToDock.html
In my project I have two Views with TabBar and I would like to customize each one with different images.
Can anyone know how to do this?
If you are wishing to customize the tabs in your tab bar, that can done by creating a UITabBarItem using the init method below and assigning it to the tabBarItem property of each navigation controller that goes into your tab bar controller. This will display the given titles and images on each tab.
navigationController.tabBarItem = [[UITabBarItem alloc] initWithTitle:#"title"
image:[UIImage imageNamedB:#"tabImage.png"]
tag:0];
Osvaldo, If you want two different backgrounds for the two different view controllers of your tab bar project you have a couple of options. But I would do the following. Grab a UIView from the object library and place one in each vc so that it fills the whole view. Next you can place UIImageViews in the UIView you just placed. Four in the one vc and five in the other. Place them and size them to however you wish. You then need to import the pictures you want to place in them. Drag the image files into the left pane, the project outline. Make sure you copy to destination so they are a part of your project. Next in the vc's click on the UIImageView that you want the picture in. On the right pane under attributes there will be a drop down menu called image. Select the image you want and it will appear in the storyboard in the vc. Do this for all the UIImageViews that you have. When on storyboards, you can pop out the storyboard outline. Make sure the UIImageViews are within the UIView. Then select the UIView in the outline and go up to the editor menu, and select arrange, send to back. It may be grayed out if the UIView was the only thing you had on the vc in the beginning. So now, this UIView will act as a background, and you can customize them to look like anything you like. Hope this helps, let us know how it goes. If it works, please accept my answer, any other questions, just ask.