之前在网络上寻找自制UIAlertView的时候,最终选择一位大哥的办法
UIAlertView tview = [[UIAlertView alloc] iniWithTitle:nil message:@"\n\n\n\n\n" delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
以消息信息为回车来撑大 UIAlertView
然后再把自己定义的view, 以[tview addSubview: myViewController.view]; 方法添入消息框
来[tView show] 实现自制ControllerView的弹出框效果
也有需要弹出框不是默认居中的方式
通过 tView.transform = CGAffineTransFormTranslate(tView.transform, 100.f,100.f); 来异动位置
这是一种简便的方法,问题是如果有自制的按钮和事件,如果 myViewcontroller大小超出 tView的范围,事件将不响应
其实不用去什么撑大UIAlertView再出一个自制页面视图覆盖在tView上面
直接: UIAlertView tview = [[UIAlertView alloc] iniWithTitle:nil message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
实现willPresentAlertView 的委托
- (void)willPresentAlertView:(UIAlertView *)alertView
{
alertView.frame = CGRectMake(100.f,200.f,500.f,500.f);
}
制定 UIAlertView的大小就可以了
自定义UIAlertView
本文介绍了一种自定义UIAlertView的方法,通过调整其大小和位置,并利用willPresentAlertView代理方法实现更灵活的布局控制。
195

被折叠的 条评论
为什么被折叠?



