【发布时间】:2013-10-08 06:38:49
【问题描述】:
我有一个目标操作,当按下按钮时,我验证UITextField:
// Get the text from the UITextField
NSString *nameStr = _name.text;
_name.rightView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"error.png"]];
[self.view addSubview:_name];
if (nameStr.length == 0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Invalid Name"
message:@"You must enter a name."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
我的UITextField 被添加到viewDidLoad 的视图中,如下所示:
[self.view addSubview:_name];
如何让 rightView UIImageView 出现?
【问题讨论】:
标签: ios uiimageview uikit uitextfield ios7