Subviews position get changed on navigation to different view and coming back - iphone

I am working on Xcode5/iOS7. I have taken Tab-Bar based application with navigation controller on first tab. On first tab and first view, i am displaying search result in UITableView on search button click and then navigate from it to the next view. But when i come back its displaying me the search screen rather then showing me the search result.Anybody has any idea why its not restoring the position of subviews and making the whole screen looks like as it was at the time of loading for the first time.
regards,
V#run

I found out the solution for my problem. We need to turn-Off Autolayout option under file inspector of view. You can do it by
View > Utilities > Show File Inspector, and un-select the “Use Autolayout” option

Try this if you are using AutoLayout:
In the .xib file, select the VIEW and on the bottom-right menu, using AutoLayout, click in |-o-| symbol and select "Add Missing Constraints In View"

Related

How to edit a View hidden behind other Views in Xcode Storyboard?

Is there an easy way in Xcode to edit a view that is hidden behind other views within the Storyboard? I know I can hide the views in front of it and move the view to the front temporarily, but this is difficult to keep doing over and over again. Is there a way to isolate the view somehow in Storyboard so I can edit it on its own?
Select your view controller in storyboard and Open File Inspector
Select Use Auto Layout and Use Trait Variations
Now select the view you want to hide in your storyboard. Open Attributes inspector. Check/uncheck the installed option to show/hide the selected view. You can hide multiple views by changing this property after selecting all the views.
Don't forget to check this option for all the views while running the app. Else it will crash

How can I add a button to the top of my TableView

I have the following in my storyboard and would like to add a button at the top of the TableView that allows me to add Members.
The scenario, a user is presented with the first screen which displays 'User Profile' and 'Members'. When 'Members' is touched the next screen is displayed that shows a list of Members and at the top is a button that says '< Settings' whcih allows the user to go back one screen.
I am trying to display a 'Add' button at the top when the list of Members is displayed.
Hope that makes sense!! I was hoping to not have to Embed the TableView in another Nav Controller.
Thanks for any help!!!!
You can add a button into the navigation bar, but first, you need to have a navigation bar.
To do this, you need to select your scene in the Storyboard and then go to the the Editor menu and select Embed In:Navigation Controller.
Once this is done, you can drag in a Navigation Item from the panel on the right.
Then you can add that to your class as an IBOutlet and declare an IBAction for it.
Cool?
Also, I think that your storyboard file might not be set up right.
Check out Apple's Simple Drill Down sample file available here:
http://developer.apple.com/library/ios/samplecode/SimpleDrillDown/Introduction/Intro.html
Cheers.

How to add initial view to Storyboard file?

I started an "Empty Application" template, this means that I had to add my own storyboard file. Problem is, it is completely blank, and I can't figure out how to get the first view on there, so I can start designing my interface.
Anyone know how to get that first view on there?
When you create a new Storyboard file, all you need to do is click/drag the UIViewController object from your right hand side of tools into your Storyboard and then you're all set to begin work on your new Storyboard.
Just in case you can not start from scratch :
Select your View Controller
Open the Attribute inspector (right pan by default)
Go to View Controller section
Select Is Initial View Controller checkmark of the Initial Scene option
In the latest version of Xcode (12.2), this is how you can add initial view to story board
Click on + Icon,
search "View Controller", Drag and drop View Controller.
Go to Edit->Show Library then drag and drop a type of View Controller that you need.

Toolbar at the bottom not showing

I used the xcode4 xib file to design the following UI:
View
Table View
Toolbar
Bar Button Item
Segmented Control
Bar Button Item
Segmented Control
On the design sheet, both Table View and Toolbar show up; but when I run the app in simulator, the toolbar is not showing up.
I tried to make the table view invisible (as a test) and to bring the toolbar to the front. Still the toolbar does not show.
Do you have any idea what I might be doing wrong, and what I should try next? Do I need to do init for the toolbar in the .m file?
Thanks much!
Lu
Have you set the the toolbarHidden property of your UINavigationControllerto NO ? You have to explicitly do this to show the toolbar as it is defaulty set to YES. If this isn't the issue, we need to see some code, especially your toolbar initialization and etc.

How do you set autosizing to flex in Interface Builder?

I have an iPhone project that I started as a Windows-based app and another View-based app. The Window app has a view which I added and I want to make the view fit within the window. In the View app the view is set to stretch.
Here is what it looks like when it is off.
(source: smallsharptools.com)
And here is when it is on.
http://www.smallsharptools.com/downloads/Stackoverflow/autosizing-on.png
I want to click in the middle of the Autosizing box but it does not do anything. What do I have to do in Interface Builder to make the View in a NIB to flex/stretch the view?
Usually when a view is locked down like that, it means that you have some simulated UI elements in place (like a fake nav bar, tab bar, or status bar). Select the top level view and go to the first tab of the inspector to see if any of those are turned on (you'd also see them on the view of course).
When they are all gone then you can change any of the resizing handles you like.
The view that is provided by default has this kind of limitation but you can overcome this by adding another view (you should delete the first view) to your xib and making this view the view of your file's owner. Besides this you would also have to change the height of this new view to 480 pxls.
Hope this helps.
Thanks,
Madhup