ios 怎么把textfield的值

2024-11-17 12:45:39
推荐回答(1个)
回答(1):

@interface ViewController : UIViewController {

UILabel *la;

UITextField *myTextField;

}

@implementation ViewController

- (void)viewDidLoad

{

[super viewDidLoad];

la = [[UILabel alloc] init];

la.Frame = CGRectMake(10, 150,300,30);

la.backgroundColor = [UIColor clearColor];

la.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];

la.text = @"initLabel";

la.textAlignment = UITextAlignmentCenter;

la.shadowColor = [UIColor colorWithWhite:0.0f alpha:0.75f];

la.shadowOffset = CGSizeMake(0.0f, 5.0f);

la.textColor = [UIColor greenColor];

[self.view addSubview:la];

UIButton *alartBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];

alartBtn.frame = CGRectMake(110, 50, 50, 50);

alartBtn.backgroundColor = [UIColor clearColor];

[alartBtn setTitle:@"alart" forState:UIControlStateNormal];

[alartBtn addTarget:self action:@selector(alartShow:) forControlEvents:UIControlEventTouchUpInside];

[alartBtn setAlpha:1.0];

[self.view addSubview:alartBtn];