rt

解决方案 »

  1.   

    这个问题很简单,不知道你下面是不是你要的代码:CGFloat btn_X = 100;
        CGFloat btn_Y = 100;
        CGFloat btn_Height = 40;
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
        [btn setFrame:CGRectMake(btn_X, btn_Y, CGRectGetWidth(self.view.frame) - btn_X * 2, btn_Height)];
        [btn setTitle:@"测试" forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    - (void)btnClick
    {
        UIViewController *vc = [[UIViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
      

  2.   

    怎么关联的 还是没明白谢谢   我知道很简单  可是我基础实在是拙计   老哥钥匙发个demo给我加上注释   我潜心研究一番我想定是极好的   层主好人下辈子美利坚
      

  3.   


    怎么关联的 还是没明白谢谢   我知道很简单  可是我基础实在是拙计   老哥钥匙发个demo给我加上注释   我潜心研究一番我想定是极好的   层主好人下辈子美利坚
      

  4.   

    卧槽这版面我要引用三次才能回复层主,智毕硬
    怎么关联的 还是没明白谢谢   我知道很简单  可是我基础实在是拙计   老哥钥匙发个demo给我加上注释   我潜心研究一番我想定是极好的   层主好人下辈子美利坚
      

  5.   

    action 交互的时候跳转。基础啊
      

  6.   


    {   // 简单说一下思路
    // 1. 创建 UIBUtton
    // 2. 应用 调用点击事件的方法
    // 3. 编写 点击事件
       
        // 创建 UIBUtton
        UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setBackgroundColor:[UIColor redColor]];
        [button setFrame:CGRectMake(50, 50, 200, 20)];
        // 加入到根视图视图
        [self.view addSubview:button];
        // 调用 引用方法方法
        [button addTarget:self action:@selector(move) forControlEvents:UIControlEventTouchUpInside];
    }// 编写引用方法
    -(void)move{
        NSLog(@"动起来");
    }
      

  7.   

    上面的解释已经很好了  第一步创建button并初始化加到根试图上  第二步在button添加的添加的事件里写你的跳转  跳转的方式根据自己而定