当我在模拟器上运行iphone应用程序时,屏幕是白色的

时间:2013-03-06 00:19:49

标签: iphone xcode crash

我不知道应用程序有什么问题它正常工作,直到我尝试将textlabel更改为textview然后崩溃。所以我尝试将其更改回工作时它仍然崩溃。有什么想法吗?

 #import "TestViewController.h"

@implementation TestViewController

@synthesize labelsText;


-(void)setup {
    titles = [NSArray arrayWithObjects:@"Title 1",@"Title 2",@"Title 3",@"Title 4", nil];
}



-(IBAction) nextclicked:(id)sender{
    titles = [NSArray arrayWithObjects:@"iology is the scientific study of life. Bam",@"This works? Wow",@"Still Works.",@"garret is the coolest awesome person awesome wowowowwwwwwwwwwwwwwwwwwwwwwwwwww", nil];
        if (step<titles.count-1) {
        step++;
    }
    else
    {
        step= 0;
    }
    labelsText.text = [titles objectAtIndex:step];
    }  



-(IBAction) prevClicked:(id)sender{
    titles = [NSArray arrayWithObjects:@"Biology is the scientific study of life. Bam",@"This works? Wow",@"Still Works.",@"garret is the coolest awesome person awesome wowowowwwwwwwwwwwwwwwwwwwwwwwwwww", nil];
    if (step>0) {
        step--;
    }
    else
    {
        step =titles.count-1;
    }
    labelsText.text = [titles objectAtIndex:step];
    }  



- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
        self.labelsText=nil;
}


- (void)dealloc {
    [super dealloc];
    [labelsText release];
}

@end

.h文件:

#import <UIKit/UIKit.h>

@interface TestViewController : UIViewController {
        UILabel *labelsText;
    UIButton *btn;
    int step;
    NSArray *titles;
                }
@property (nonatomic, retain) UILabel *labelsText;
 -(IBAction) nextclicked:(id)sender;
-(IBAction) prevClicked:(id)sender;



    @end

1 个答案:

答案 0 :(得分:0)

我想你错过了这个:

在您的示例中,它应该是 labelstext 和按钮。

enter image description here