Ios 移动按钮后文本不可见 float newY=0; CGRect按钮框架; 对于(int i=1;i

Ios 移动按钮后文本不可见 float newY=0; CGRect按钮框架; 对于(int i=1;i,ios,objective-c,iphone,uibutton,Ios,Objective C,Iphone,Uibutton,[self-viewWithTag:i];不保留任何内容,因此项目对象的发布不应存在。按钮对象的发布也是如此。尝试删除这两个版本,看看它是否解决了您的问题 float newY = 0; CGRect buttonFrame; for(int i=1; i<=countTabItems;i++){ id item = [self viewWithTag:i]; if([item isKindOfClass:[UIButton class]]){ UIButt

[self-viewWithTag:i];
不保留任何内容,因此项目对象的发布不应存在。按钮对象的发布也是如此。尝试删除这两个版本,看看它是否解决了您的问题

float newY = 0;
CGRect buttonFrame;
for(int i=1; i<=countTabItems;i++){
    id item = [self viewWithTag:i];
    if([item isKindOfClass:[UIButton class]]){
        UIButton *button = item;
        [item release];
        NSLog(@"got %@", button.titleLabel.text);
        buttonFrame = button.frame;
        buttonFrame.size.height = self.frame.size.height/countTabItems;
        buttonFrame.size.width = self.frame.size.width;
        buttonFrame.origin.x = 0;
        buttonFrame.origin.y = newY;

        button.frame = buttonFrame;
        [button setTitle:@"TEST" forState:UIControlStateNormal];
        NSLog(@"%0.2f",newY);
        [button release];
        newY += frame.size.height/countTabItems;
    }
}