iOS中UIAlertView警告框组件的使用教程

2020-01-15 15:04:09于丽

                  view.frame = btnFrame;

            }

}

UITextField* accoutName = [[UITextFieldalloc] init];

UITextField* accoutPassword = [[UITextFieldalloc] init];

accoutName.frame = CGRectMake( 10, frame.origin.y + 40,frame.size.width - 20, 30 );

accoutPassword.frame = CGRectMake( 10, frame.origin.y + 80,frame.size.width -20, 30 );

accoutName.placeholder = @"请输入账号";

accoutPassword.placeholder = @"请输入密码";

accoutPassword.secureTextEntry = YES;

[alertView addSubview:accoutPassword];

[alertView addSubview:accoutName];

[accoutName release];

[accoutPassword release];

}


显示将消息框固有的button和label移位, 不然添加的text field会将其遮盖住。 然后添加需要的部件到相应的位置即可。

 

对于UIActionSheet其实也是一样的, 在

复制代码
(void)willPresentActionSheet:(UIActionSheet *)actionSheet
中做同样的处理一样可以得到自己想要的界面。  
注:相关教程知识阅读请移步到IOS开发频道。