I'm using an ECSSlidingViewController (on iPhone) it works perfectly but I would like to do something special.
In my App I have an ECSSlidingViewController, a Menu (UITableViewController) for the underLeftViewControllerStoryboardId and several others UINavigationViewController when a menu entry is selected.
A user can navigate from the Mail App to my App using an attachment in the mail. When this navigation happens (and the App was already started) I need to display one of the UINavigationViewController from my Menu.
I'm able to display the Menu anywhere the user is in the App hierarchy with the following code
ECSlidingViewController* viewController = [DataCenter sharedInstance].slidingViewController;
[viewController anchorTopViewToRightAnimated:FALSE];
Next, I'm not able to display on the full screen the UINavigationViewController I would like to show.
Any idea how to do that?
Thanks for your help
Sébastien.
I'm guessing you're using storyboards:
self.slidingViewController.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"StoryBoardIdOfNavigationController"];
[self.slidingViewController resetTopViewAnimated:NO];
Related
I'm developing my first iPhone app. I'm still not very good at Xcode and my question is pretty simple. I'm using Xcode 5 and I'm using storyboards in my project.
Well, I have some images in a View Controller. I'd just like that if I tap one of those images I switch to another View Controller, nothing else. How do I exactly do that?
I looked for a solution online and I found out on YouTube that I have just to Control-Click my image and connect it to another view using a modal connection, without any code. However I tried in the simulator and it doesn't work. Also, most of tutorials online are outdated and they explain how to do it on Xcode 4.2 and without using storyboards.
Can you help me please? Thank you.
Try this:
HomeViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:#"Home"];
[self presentViewController:vc animated:YES completion:nil];
with Home is Storyboard ID of Home Screen
You can't just use a UIImage. You need to use a UIButton and then under the properties set the button to custom and set background image to the image you want. Then you can click and drag from the button to the new view and choose modal.
I'm having you choose modal because from what I can gather, you aren't using a navigation controller. Therefore you'd modally want to present the view controller.
I am building basic application. It uses the tab bar with 3 views. I have a button on the first view. When i click it, i want it to switch to like the 3rd view but keep the tab bar at the bottom. Right now, i have it working, but when it switches to the 3rd view, i lose the tab bar.
I am new so take it easy on me. I have tried searching in this site, but nothing helps entirely. If possible please provide the code and which files it should go into.
In my .h i put this code:
-(IBAction) btnClickedSell1:(id) sender;
In the .m i put this code:
-(IBAction) btnClickedSell1:(id) sender {
Selling *second = [[Selling alloc] initWithNibName:nil bundle:nil];
[self presentModalViewController:second animated:YES];
}
I believe i must have the right code however i'm not sure of which files they should go into exactly and the exact steps to take in IB.
Any help is greatly appreciated!
You should not use presentModalViewController:animated, if you just want to switch to the 3rd view I think you should try this code:
[yourTabBarController setSelectedIndex:2];
you can get yourTabBarController by NSApplicationDelegate if your app is based on TabBar application.
In tab based Application each bar button is act as like ViewController. So you can redirect into next ViewController You can't keep your first Bar button.
actually I'm quite new with Xcode and couldn't find the answer to the following two questions by a google search:
to make it short: I'm working on an iPad app that displays proposals. For this purpose you should choose a proposal from the table in MasterView and then see the details in the DetailsView in landscape mode (but without the MasterView on the Spitscreen).
So when the app starts in landscape mode, I wanna see directly the first proposal full screen on the DetailsView. And when I tap onto the screen the MasterView should popup/unhide with the other proposals in the table. Is this possible?
I wanna display the PDFs in a WebView like in iBooks. That means that the navigation bar is hidden and only when I tap onto the screen the navigation bar should appear at the top of the screen.
I'm kind of sure this questions have been solved somewhere but I couldn't find anything by search so I hope you can help me anyway :-)
Thanks in Advance!
Q1: Use can use one of many methods to present a view (look up under Apple's doc on UIViewController under "Presenting Another View Controller's Content" heading). Two that I have used are: – presentModalViewController:animated: and – presentViewController:animated:completion: (the latter is the latest addition in iOS 5.0)
So let's say you have a detail controller called MyDetailViewController, in your Master View Controller's implementation file (the .m file), under viewDidLoad method, you would do some thing like this to present it as a full screen view.
MyDetailViewController *myDetailViewController = [[MyDetailViewController alloc] initWithNibName:#"MyDetailViewController" bundle:nil];
[myDetailViewController.view setFrame:CGRectMake(0, 0, 1024, 768)]; //might not need this
[self presentViewController:newDetailViewController animated:YES completion:^{
NSLog(#"complete"); //optional
} ];
To dismiss or hide this MyDetailViewController with a tap or touch, you can use UITapGestureRecognizer or touchesEnded method and using one of the dismiss methods (refer back to Apple's UIViewController again for this).
Q2: I personally have not used UIWebView to display PDF and not sure if iBooks is using UIWebview to do it. But to display a varieties of popular documents formats, you can use either the QLPreviewController class or UIDocumentInteractionController. You can hide the toolbar while the document is displayed.
Good luck.
I have an app that opens with a splash screen (Default.png), then loads the first view (ViewController1) in a navigation controller. Straight away, an instance of ViewController2 (VC2) is created, and pushed onto the navigation controller:
[self.navigationController pushViewController:VC2 animated:NO];
So when I run the app, the default image is displayed, then the view of ViewController1 is briefly displayed until ViewController2 is loaded (and then displayed).
How can I stop the brief display of ViewController1? Can I extend the display of Default.png until VC2 is displayed, or cover ViewController1 with the Default.png image until VC2 shows?
Thanks so much.
If the only thing you want to do is to show VC2 without showing VC1, in the viewDidLoad method of your VC1 you can do self.view.hidden = YES; then push the VC2 without animation
I think in your case, you want VC2 to be your starting point with VC1 as your ad-hoc splash screen. The default.png images should be a way to mirror the look of your app to give the impression your app is starting and working faster than it may appear. (This is taken from Apple's HIG)
You may want to consider making VC1 your new splashscreen/loading screen. You could make it into a simple waiting or loading page then load VC2 once everything in your app has been taken care of. Default.png could be an image of the loading screen and would give the impression your app is loading right away.
There are many differing opinions of how to approach this issue. You will ultimately have to decide which method is best for you and your application.
One final thought, you could load directly to VC2 and just present a loading progress view. I have used MBProgressHUD to lock the user out while I load information or perform tasks they need to wait for. This could be another option. Hope this information helps.
You can add a UIImageView to VC1 with Default.png, then remove it in viewDidDisappear:.
I don't think you can modify the Default.png behaviour. I would suggest you create an UIImageView in ViewController1 with Default.png as its image. Give it the exact same size as the screen and add it as a subview that completetely covers it. That way you will see Deafult.png twice and after it will go to ViewController2
I am trying to write an app that displays a simple logo/splash page while the app retrieves some data. I cannot seem to find a tutorial anywhere.
I have a "MainWindow.xib" file that will have my splash page, and I'm setting that as my "Main Interface" in my Info.plist, however, I cannot seem to see how to replace that page with a .xib that contains a UINavigationController. I thought I would just create a new UIController, that had a UINavigationController and in my .xib I'll drag in a Navigation Controller and set all my information, but it's giving me real fits.
So, I figured I would have a UIController that I would "alloc" and "init" with my second .xib that contains all my navigation.
myMainController = [[UIController alloc] initWithNibName:#"MainNavController":nil];
in "MainNavController.xib", I've dragged in a Navigation Controller, but I don't know what to connect it to????
I'm sure I'm going down the wrong, path; but I cannot find a decent tutorial for this.
Can someone give direction or link to a decent tutorial?
Thanks.
Are you ever actually adding the new controller to your existing view? If not, something like:
[self.view addSubview:myMainController.view];
should do it for you. A better alternative is likely to be:
self.window.rootViewController = myMainController;
But I'm fairly new to this and maybe I've missed something ...
To display a splash screen while the app is loading you can use Default.png image file.
However, I think your question is how to display another splash screen for a period of time after the app has been loaded.
In you MainWindow.xib keep your window separated from your Navigation Controller. Add your splash screen view with an image to the xib.
Make two outlets: one for slash view, one for Navigation Controller.
IBOutlet UIView* _spashScreenView;
IBOutlet UINavigationController* _navigationController;
In applicationDidFinishLaunching method add your splash screen view to the window.
[_window addSubview:_spashScreenView];
// lay it out
When you are ready to display your navigation controller:
[_spashScreenView removeFromSuperView];
[_window addSubview:_navigationController];