how to hide UIButton in UIViewController in IOS? - uibutton

As shown in screen shot i have login page, which contains login and registration buttons, after registration over i need hide the registration button.
click here to view screenshots

Yes you need to hide it programmatically.You can have two option.
ButtonOutlet.hidden = YES;
OR Other thing
in interface builder set Hidden

Related

On clicking a tab need to answer an alert before moving into the tab clicked - iPad programming

There are many tabs in my screen,I want to give an alert box which says "Do you want to save the changes?" if user changes anything in the page, without clicking on the save button provided in the page,he is clicking on diff tab.
I'm able to get the alert view but the tab click moves the screen to the tab which was clicked. The screen should not change until the alert view is answered.
Can anyone let me know how to suppress the screen change until the alert view is answered ?
This doesn't directly answer your question, but: what you're trying to do sounds like bad UI design. (In general, if it feels like you are fighting against UIKit, you're probably doing it the wrong.)
In this case: if you really want to ensure that a user taps a Save button before moving to a different screen, you should present that screen in a modal view, so that it is impossible to navigate to any other part of the app.
In other words, if you want to prevent a user from navigating away from a screen, don't show them buttons or tabs that would allow them to navigate away. Otherwise, you're just making more work for yourself and frustrating a user.
Implement UITabBarControllerDelegate in your app delegate's applicationDidFinishLaunching
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
self.tabBarController.delegate = self;
[window addSubview:self.tabBarController.view];
}
Then use the below delegate method,
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;
This method is called before the tab switch and you can return no here to disable that and show an alert message instead. Once the user has performed the save either he can press on tab again or you can programmatically switch to the new tab as,
self.tabBarController.selectedViewController = [self.tabBarController.viewControllers objectAtIndex:0];
Add this inside your delegate,
How about this for switching to the tab programmatically,
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if () {
//some code
} else {
//some other code
self.tabBarController.selectedViewController = viewController;
}
}

How do I hide the master part of a UISplitViewController programatically?

In my UISplitViewController, I want the "master" part of the view to hide itself and the "detail" part take over the full screen when the user clicks a button in landscape. Likewise, clicking the button again takes the user back the standard, split screen view. Is it possible to do this with the built-in class?
There's a method you can implement from UISplitViewControllerDelegate in iOS5:
- (BOOL)splitViewController:(UISplitViewController*)svc
shouldHideViewController:(UIViewController *)vc
inOrientation:(UIInterfaceOrientation)orientation
{
return YES;
}
MGSplitViewController has that functionality built in for pre-ios5 work.

Dismissing a modal view controller using a different animation than it was presented with

I have an application that presents a view controller (for registering / logging in) with a container view, and two views as switched between eachother using horizontal flipping. The app itself can be used before registration. I'm looking to change the way this is handled with storyboarding.
So upon opening the app there's a login button. If the user taps login a view controller is presented using Cover Vertical animation. On the top left of this view controller is a button to Register. Tapping on that does modal segue with a Horizontal Flip animation. On the Register view controller there's Login and Cancel buttons. I want Login to return to the login screen, and Cancel to go back to the view controller that was displayed using the Cover Vertical animation. Getting it there is fine, but the animation used is the Horizontal Flip animation, and not a (un)Cover Vertical animation.
I'ved tried the following code:
self.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
before dismissing the view controller, but it's still flipping instead of uncovering.
Thanks for the help!
~James
I see no reason that shouldn't work, but as an example here's the code I would use:
[self setModalTransitionStyle:UIModalTransitionStyleCoverVertical];
[self dismissModalViewControllerAnimated:YES];
I suggest trying this, it works well for me.
for Swift you can call this:
viewController.modalTransitionStyle = .coverVertical
viewController.dismiss(animated: true, completion: nil)

A button is added to the navigation bar which is shown on all the screens. I need to hide it from all screens except one

In my app for iPad, I have first a welcome screen then home screen and then home screen navigates to rest of the screens. I have made a button on navigation bar of the home screen which takes the user back to the welcome screen. But that button is shown on all other screens as well. I want to remove that button from all the screens and show it only in the home screen. How can I hide that button from all other screens and make it visible only on the home screen?
Thanks PC
In viewDidDisappear:
self.navigationItem.rightBarButtonItem = nil;
// or on whichever side your button is
In viewWillAppear:
self.navigationItem.rightBarButtonItem = self.showWelcomeButton;
// self.showWelcomeButton is a retained UIBarButtonItem property

keyboard not appearing when uitextfield is pressed

I have presented a navigation controller (Nav1) as modal view controller from rootViewController
Then from Nav1 i created another navigation controller (Nav2) and presented it as modal view controller.
In nav2 when i click a table cell it pushes a view controller containing UITextField
Now the problem is when I click on UITextField it does not show iphone keyboard
Actually I am trying to make something like alarm label as in iphone clock app.
Just be sure for you have set the delegate the textfield...
[textField setDelegate:self];
why did you choose two nav controllers?
you can use tabbarcontroller by the way there is much more simpler way to achieve this.Search on google
check if
"reloadData"
is not executing before the UITextField becomes active