How to change the appearance of a button on an iPhone without a navigation controller?

I want to know how to change the view of the click button on an iPhone without a navigation controller?

+3
source share
5 answers

If you do this using the UIViewController, you will probably do it like this:

- (IBAction)change {
    UIViewController* viewController = [[UIViewController alloc] init];
    [self.view addSubView];
    // Save the UIViewController somewhere if necessary, otherwise release it
}

Not sure why you don't want to use the UINavigationController. If this is the navigation bar at the top that you do not want to see, there is a property for this so that you can hide this bar. Not sure if this name is probably NavigationBarHidden or something like that. You can see this in the API.

+4
source

There are many different ways to do this, and you must provide additional information about your application.

: :

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];    
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

[vc1 viewWillDisappear:YES];
[vc2 viewWillAppear:YES];
vc1.view.hidden = YES;
vc2.view.hidden = NO;
[vc1 viewDidDisappear:YES];
[vc2 viewDidAppear:YES];

[UIView commitAnimations];

, / . , / :

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];    
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];

[vc1 viewWillDisappear:YES];
[vc2 viewWillAppear:YES];
[vc1 removeFromSuperview];
[masterController.view addSubview:vc2.view;
[vc1 viewDidDisappear:YES];
[vc2 viewDidAppear:YES];

[UIView commitAnimations];
+3

IBAction Button

[mCurrentView removeFromSuperview];
[self.view addSubView: mNewView];

+1

, myView1 myView2 myUIButton

myView1.tag = 1;
myView2.tag = 2;
myUIButton.tag = 1; //Current visible view is myView1

-(void) ButtonCLicked:(id) sender 
{
       UIButton* myButton = (UIButton*)sender;


       if(sender.tag == 1)
       {
           [myView1 removeFromSuperview];
           [self addSubview:myView2]
           myButton.tag = myView2.tag;
       }
       else 
      {
          [myView2 removeFromSuperview];
          [self addSubview:myView1]
           myButton.tag = myView1.tag;
      }
}
+1

UIView / :

-(IBAction)changeView {

    UIView *view = [[UIView alloc] initWithNibName:@"letMeSeeThis" bundle:nil];
    [self.view addSubview:view];
}
0

All Articles