一旦初始化或可分配变量

时间:2015-08-28 09:24:03

标签: ios objective-c xcode

这是我的代码:

- (IBAction)btnFutApt:(UIButton *)sender {

   CGSize rec;
    rec.height = view.frame.size.height;

    sender.selected = !sender.selected;
    CGRect newFrame ;
    NSLog(@"HEFU %f ", rec.height);

    if (sender.selected) {
        viewFuExtMain.hidden = TRUE;
        viewFuIntMain.hidden = true;
         newFrame = viewFutAptMain.frame;
        newFrame.size.height = 115  ;
        viewFutAptMain.frame = newFrame;


    }
    else {

        viewFuExtMain.hidden = FALSE;
        viewFuIntMain.hidden = FALSE;
        newFrame = viewFutAptMain.frame;
        newFrame.size.height =  rec.height;
        viewFuMain.frame = newFrame;



    }
     NSLog(@"HEFU %f", rec.height);
}

想要一个变量将存储高度,不会不惜任何代价改变..

1 个答案:

答案 0 :(得分:0)

  

使用您的存储值编写Getter方法初始化。试试我提到下面的代码

@property(nonAtomic, Strong, get) CGFloat *Height;