-1

iPhoneアプリで予期しない問題が発生しました。何らかの理由で、これをコンパイルすると、SIGABRTエラーが発生します。それはで起こります:

    textFieldRounded=[[UITextField alloc]initWithframe: CGRectMake(20,50,280,31)];
    textFieldRounded.borderStyle=UITextBorderStyleRoundedRect;
    textFieldRounded.textColor=[UIColor blackColor];
    textFieldRounded.font=[UIFont systemFontOfSize:17.0];
    textFieldRounded.placeholder=@"enter your name";
    textFieldRounded.backgroundColor=[UIColor whiteColor];
    textFieldRounded.autocorrectionType=UITextAutocorrectionTypeNo;
    textFieldRounded.backgroundColor=[UIColor clearColor];
    textFieldRounded.keyboardType=UIKeyboardTypeDefault;
    textFieldRounded.returnKeyType=UIReturnKeyDone;
    textFieldRounded.clearButtonMode=UITextFieldViewModeWhileEditing;
    [self.view addSubView:textFieldRounded];
    textFieldRounded.delegate=self;    
    UIButton *button =[UIButton buttonWithType:UIButtonTypeRoundedRect];
    [button addTarget:self action:@selector(buttonPressed:)
     forControlEvents:UIControlEventTouchDown];
    [button setTitle:@"Button" forstate:UIControlStateNormal];
    button.frame = CGRectMake(20,108,97,37);
    [self.view addSubview:button];
    label= [[UILabel alloc] initWithFrame:CGRectMake(40,243,240,21)];
    label.backgroundColor=[UIColor clearColor];
    label.textAlignment,UITextAlignmentCenter;
    label.text=@"Label";
    [self.view addSubview:label];    
    CGRect myImageRect = CGRectMake(40.0f,190.0f,240.0f,128.0f);
    image= [[UIImageView alloc] initWithFrame:myImageRect];
    [image setImage:[UIImage imageNamed:@"Default@2x.png"]];
    image.backgroundColor=[UIColor clearColor];
    image.opaque =YES;
    image.alpha=0;
    [self.view addSubview:image];
    [image release];
}
4

1 に答える 1

1

あなたはクリートすることができますUITextFieldUIButtonまたはUILabelこの以下のコードのように:-

UITextField

UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 200, 300, 40)];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.font = [UIFont systemFontOfSize:15];
textField.placeholder = @"enter text";
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.keyboardType = UIKeyboardTypeDefault;
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;    
textField.delegate = self;
[self.view addSubview:textField];
[textField release];

UIButton

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"UIButton" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
[button release];

UILabel

UILabel *headingLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 240, 300, 30)];

[self.view addSubview:headingLabel];

//オプション

headingLabel.text = @"WELCOME";
headingLabel.textColor = [UIColor orangeColor];
headingLabel.textAlignment = UITextAlignmentCenter;
headingLabel.tag = 10;
headingLabel.backgroundColor = [UIColor clearColor];
headingLabel.font = [UIFont fontWithName:@"MarkerFelt-Thin" size:14.0];
headingLabel.hidden = NO;
headingLabel.highlighted = YES;
headingLabel.highlightedTextColor = [UIColor blueColor];
headingLabel.lineBreakMode = YES;
headingLabel.numberOfLines = 0;

UIImageView

UIImageView *myImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150, 150)];
myImage.image = [UIImage imageNamed:@"myImage.png"];
[self.view addSubview:myImage];
[mymyImage release];

それがあなたを助けることを願っています

于 2013-01-10T09:24:59.760 に答える