0

我想在视图上获取一个文本字段。该视图的代码是

            if (indexPath.row==0) {
            UIView *viewshow=[[[UIView alloc]init]autorelease];
            viewshow.frame = CGRectMake(5, 60, 310, 230);
            viewshow.backgroundColor=[UIColor whiteColor];
            [cell addSubview:viewshow];

}

并通过此代码获取自定义文本字段

            if (indexPath.row==0) {
            UIView *viewshow=[[[UIView alloc]init]autorelease];
            viewshow.frame = CGRectMake(5, 60, 310, 230);
            viewshow.backgroundColor=[UIColor whiteColor];
            [cell addSubview:viewshow];
            UITextField* textField = [[UITextField alloc] initWithFrame:CGRectMake(5, 10, 30, 200)];
            textField.borderStyle = UITextBorderStyleRoundedRect;
            textField.placeholder = @"Enter the Text";
            textField.font = [UIFont fontWithName:@"Helvetica" size:12.0];
            textField.delegate = self;
            //cell.accessoryView = textField;
            [viewshow addSubview:textField];
         }

现在文本字段在视图中是垂直方向而不是水平方向。现在我不明白我到底需要做什么来解决这个问题。请帮忙.....

4

1 回答 1

0

uitextfield改变ie的框架宽度和高度,

 UITextField* textField = [[UITextField alloc] initWithFrame:CGRectMake(5, 10, 200, 30)];
于 2013-05-29T07:25:53.710 回答