<i id='9MwvT'><tr id='9MwvT'><dt id='9MwvT'><q id='9MwvT'><span id='9MwvT'><b id='9MwvT'><form id='9MwvT'><ins id='9MwvT'></ins><ul id='9MwvT'></ul><sub id='9MwvT'></sub></form><legend id='9MwvT'></legend><bdo id='9MwvT'><pre id='9MwvT'><center id='9MwvT'></center></pre></bdo></b><th id='9MwvT'></th></span></q></dt></tr></i><div id='9MwvT'><tfoot id='9MwvT'></tfoot><dl id='9MwvT'><fieldset id='9MwvT'></fieldset></dl></div>

      <bdo id='9MwvT'></bdo><ul id='9MwvT'></ul>

    <small id='9MwvT'></small><noframes id='9MwvT'>

  1. <tfoot id='9MwvT'></tfoot>

  2. <legend id='9MwvT'><style id='9MwvT'><dir id='9MwvT'><q id='9MwvT'></q></dir></style></legend>
    1. UIButton动作不起作用ios

      UIButton action not working ios(UIButton动作不起作用ios)
      <tfoot id='tDKsu'></tfoot>
    2. <legend id='tDKsu'><style id='tDKsu'><dir id='tDKsu'><q id='tDKsu'></q></dir></style></legend>

        <small id='tDKsu'></small><noframes id='tDKsu'>

            <tbody id='tDKsu'></tbody>

            • <i id='tDKsu'><tr id='tDKsu'><dt id='tDKsu'><q id='tDKsu'><span id='tDKsu'><b id='tDKsu'><form id='tDKsu'><ins id='tDKsu'></ins><ul id='tDKsu'></ul><sub id='tDKsu'></sub></form><legend id='tDKsu'></legend><bdo id='tDKsu'><pre id='tDKsu'><center id='tDKsu'></center></pre></bdo></b><th id='tDKsu'></th></span></q></dt></tr></i><div id='tDKsu'><tfoot id='tDKsu'></tfoot><dl id='tDKsu'><fieldset id='tDKsu'></fieldset></dl></div>
                <bdo id='tDKsu'></bdo><ul id='tDKsu'></ul>
              • 本文介绍了UIButton动作不起作用ios的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我将 xcode 6.2 更新为 7 并添加:

                I update xcode 6.2 to 7 and add :

                self.window.rootViewController = [UIViewController new];
                

                在 AppDelegate.m 中

                in AppDelegate.m

                - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
                    // Override point for customization after application launch.
                
                    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
                
                    //add in there
                    self.window.rootViewController = [UIViewController new];
                
                ViewController2 *viewController = [[ViewController2 alloc] init];
                        UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
                        navController.navigationBar.tintColor = [UIColor colorWithRed:0/255.0 green: 30.0/255.0 blue: 200.0/255.0 alpha:1];
                        [self.window addSubview:navController.view];
                        return YES;
                    }
                

                但是现在

                [button_Sinnup addTarget:self action:@selector(PLP) forControlEvents:UIControlEventTouchUpInside];
                

                此代码在 ViewController2.m 中不起作用

                this code not working in the ViewController2.m

                - (void)viewDidLoad {
                    [super viewDidLoad];
                    // Do any additional setup after loading the view.
                    [self.view setBackgroundColor:[UIColor blueColor]];
                    UIButton *button_Sinnup = [UIButton buttonWithType:UIButtonTypeCustom];
                    [button_Sinnup setTitle:@"" forState:UIControlStateNormal];
                    [button_Sinnup addTarget:self action:@selector(PLP) forControlEvents:UIControlEventTouchUpInside];
                    button_Sinnup.frame = CGRectMake(16, 76, 185, 45);
                    [button_Sinnup setBackgroundColor:[UIColor colorWithRed:224.0f/255.0f green:31.0f/255.0f blue:73.0f/255.0 alpha:0]];
                    [ button_Sinnup setBackgroundColor:[UIColor redColor]];
                    [self.view addSubview:button_Sinnup];
                }
                

                我无法调用方法 PLP

                i can't call the method PLP

                - (void)PLP{
                    ViewController2* svc=[[ViewController2 alloc]init];
                    [self presentViewController:svc animated:YES completion:nil];
                
                }
                

                推荐答案

                你在添加导航控制器时出错了:替换:

                You are wrong at adding navigation controller: replace:

                [self.window addSubview:navController.view];
                

                self.window.rootViewController = navController;
                

                这篇关于UIButton动作不起作用ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                UIButton title text color(UIButton 标题文本颜色)
                Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                iPhone UIButton - image position(iPhone UIButton - 图像位置)
                UIButton remove all target-actions(UIButton 删除所有目标动作)
                <legend id='ybtk9'><style id='ybtk9'><dir id='ybtk9'><q id='ybtk9'></q></dir></style></legend>

                    <bdo id='ybtk9'></bdo><ul id='ybtk9'></ul>
                    • <i id='ybtk9'><tr id='ybtk9'><dt id='ybtk9'><q id='ybtk9'><span id='ybtk9'><b id='ybtk9'><form id='ybtk9'><ins id='ybtk9'></ins><ul id='ybtk9'></ul><sub id='ybtk9'></sub></form><legend id='ybtk9'></legend><bdo id='ybtk9'><pre id='ybtk9'><center id='ybtk9'></center></pre></bdo></b><th id='ybtk9'></th></span></q></dt></tr></i><div id='ybtk9'><tfoot id='ybtk9'></tfoot><dl id='ybtk9'><fieldset id='ybtk9'></fieldset></dl></div>
                        <tbody id='ybtk9'></tbody>

                        <small id='ybtk9'></small><noframes id='ybtk9'>

                          <tfoot id='ybtk9'></tfoot>