iOS5 - Storyboard - showing another view - iphone

This is simple one though:
I'm having XCode 4.2 with iOS beta7. I am just trying a to have to views with one button in first view. On click of button, it will show next view.
In many tutorials, when I click and drag the button to next view, it will show "performSegueWithIdentifier:sender:" view.
But in my interface builder, its showing "Storyboard Segues with Push, Modal, Popover, Custom......"
I don't know whether I'm doing wrong or its the behavior of the xcode itself....
can some one suggest me good tutorials for iOS5 storyboard please?

Yes, you doing everything right. Push, Modal are types of showing next screen (UIView). You need to select it according Human Interface Guidelines from Apple.

Related

How to open another view when button is clicked in iOS app development?

I am trying to build an app, and I want another view to open up once I click a button. I have searched for an answer, but nothing came up. I already have the button done, but I don't know how to get another view to show up. The view should be another view within the app. I am just a beginner in xCode. Thanks.
I am currently using xCode 9, and swift 4. Thanks.
You can approach this either using the storyboard or programmatically. Using the storyboard, you can ctrl-drag from the button to the other view controller and the segue will be wired up for you, like so:
If you aren't using storyboards at all, you can use the .show method of the ViewController in the button action. Apple has a good guide on segues.

How to swipe out of table view controller (not the cells) - iPhone

I have a tab bar app. It has 5 tabs. I have the 3rd tab connected to a navigation controller that's connected to a table view controller. Simple enough, right?
Well, I recently decided to implement left/right swipe gestures as an optional way to navigate left and right to each tab in the tab bar controlled app. The gestures work great, except I don't have a way to implement the gestures on the 3rd tab (the one with the UITableView) because there's no implementation file associated with it.
And that's my question: How can I implement the gestures on the third tab so I can navigate AWAY from it by swiping?? I can swipe into that tab, but not out of it. I'm fairly new to iOS dev, and I really appreciate any help!
(Using ARC, Storyboard, & Xcode 4.5.2)
EDIT:
Here's a screenshot of how my Table View Controller is connected to my Tab Bar Controller:
SOLUTION:
The answer marked correct is indeed correct. It explained to me how to make a subclass of my UITableViewController. But I was also wondering how to implement my TableView programmatically... so after a bit of searching, this link pretty much shows exactly how to do that: Ruchi Raval's post on mobisoftinfotech. However, I ended up just following the steps in the link, and I ended up deleting my original UITableViewController because I had created a new one through the steps in the link and connected it to my NavigationController through the Storyboard (ctrl + drag).
Hope this helps anyone that had my same quesions!
To control gestures on a VC, you'll need your own subclass. Create a new objective-c object named like MyTableViewController. Xcode lets you specify a superclass when creating the files, use UITableViewController.
Xcode provides some template code in the new files -- leave that alone to begin with. In storyboard, I think the tab you're trying to fix has a navigation (vc) whose root vc is a UITableViewController.
Select that table vc and select the Identity inspector (upper right, third tab from the left). You should see a section called custom class. The current class is probably UITableViewController. Change that to MyTableViewController, or whatever you named the new class.
Build and run. Now you control that table vc. Back in it's implementation file, you can add your gesture code in viewDidLoad:.

How to design multiple views in iPhone

I am making code for iPhone. My first screen has only one button with text Menu. When user will click on this button next screen is coming with multiple navigation bar.Each Navigation bar has their own Text information which are being selected after clicking on any Navigation bar.
How i should to design it for iPhone ? Please give me concept. Should i take multiple views ? If i have multiple views how will i hide and show on button click event ?
Thanks in advance.
You will have to adapt your user interface to comply to how Apple wants an app to work, look, and feel - or make your own custom viewcontrollers. Even then, you might not get the exact behavior you want.
My hottest tip is to look at similar apps on appstore and see how they are navigated.
I don't get a picture in my mind from your description, but it seems you want what is called "drill down". This is best done with tableViews.
You can't have multiple navigation controllers on the same "screen"; it doesn't work like that on the iPhone. Instead, what you have is one single Navigation controller, that controls the pushing of views. You decide which sub-view to push depending on which selection the user makes, and the Navigation controller handles the rest of the interaction with the user to let him or her navigate between the views.
Example structure:
Window-based app
+-MainWindow.xib
| +-First view with button
| +-UINavigationController
+-tableview1.xib
+-tableview2.xib
+-any more views you need.
Make the app delegate a <UINavigationControllerDelegate> and declare navCt *UINavigationController, and connect it in Interface Builder. You can then write a pushVC method, which takes as argument a UIViewController *vc. It does a [navCt pushViewController:vc animated:YES];
Connect the button to an IBAction, which then calls the method in the app delegate, [PushVC myVC], where myVC refers to any viewcontroller in your app, in this case table view 1.
In this table, on didSelectRow... event you can use the same method to push the sub-view table view 2.
I think this is minimum code if you are unsure about iPhone app design. Either way, I hope it gives some ideas.
You should read about UINavigationController, UITabBarController, UIViewController.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
You almost always make one view pr. viewcontroller.

Starting an app with a Tab View and no tabs selected?

I'm developing an iPhone app with Objective-C and iOS SDK with a tab view on the bottom. I want to make the app so that when it first loads up, the tabs are on the bottom, but none of them are selected. Instead, the user is presented with a "home" view, and can select the tabs from there if he / she desires.
How would I make this work? I'm assuming it's something in the App Delegate?
Thanks!
I did this recently. Just do
[self.myTabBar setSelectedItem:nil];
Works perfectly, no tabs should be selected. Let me know if you have any problems. Also, just put that in either - (void) viewDidLoad or initWithNibName .
I think this would be something that's appropriate to fake.
I would:
Add a subview that overlays the area normally occupied by the selected tab view.
Add UITabBarControllerDelegate tabBarController:shouldSelectViewController that will hide/remove that view.
The only remaining problem is to make the actually selected tab button seem unselected until the subview is hidden.

How to force a screen orientation in specific view controllers?

My application is pretty simple: it starts up with a view controller that holds a table view (in grouped view layout) with a few options. When the user taps on one of the options, I push another view controller onto my navigation controller.
This second view controller simply displays a UIImageView, and the user can change the screen orientation on this view controller between portrait/landscape modes. This works just fine, and all is happy.
However, if the user taps on the "Back" button on my navigation bar while on the landscape mode, the first controller's layout is all messed up. See below for before/after screenshots:
(source: pessoal.org)
(source: pessoal.org)
Any clues on how to force the first view controller (second screenshot in this post) to stay within the portrait screen orientation?
There does not appear to be a way to do this using the documented methods.
I have filed a bug for this: rdar://6399924
"There is no way to always restrict a UIViewController to one orientation"
You can see it on open radar (along with a link to sample code to reproduce the problem) here: http://openradar.appspot.com/radar?id=697
Like someone on the open radar suggested, a workaround is to disable "back" button while in non-portrait:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
// don't let user press "back" button in landscape - otherwise previous view and the rest of the application
// will also be in landscape which we did not feel like testing yet
self.navigationController.navigationBarHidden = (UIInterfaceOrientationPortrait != self.interfaceOrientation);
}
There is a solution to do that : it's to use a view controller and adding its view to the window. then in that controller you force landscape in the shouldAutorotate... methode. It works fine, but be sure it's necessary for your project to use that, because it's not very smart  to force the user to turn his iPhone. By the way, here is an example code if you need it.
http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html
I wasn't able to get this to work the way I wanted. You ought to be able to set a particular orientation for a ViewController, but the NavigationController doesn't seem to always do the right thing.
I ennded up re-designing my screens so that they all work in either orientation. That might be extra work, but it "feels" more natural, anyway.