自定义UIAlertView背景
2013-09-16 15:37
411 查看
系统自带的UIAlertView背景有点丑,我们可以自定义,写一个UIAlertView的类别. 核心代码如下:
- (void)changeBackground{
for (UIView *view in [self subviews]) {
if ([view isKindOfClass:[UIImageView class]]) {
UIImage *image = [UIImage imageNamed:@"5-1.png"];
UIImageView *back = (UIImageView *)view;
back.image = image;
break;
}
}
}
调用方式:
UIAlertView *alert = [[UIAlertView
alloc]initWithTitle:@"a"
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil,
nil];
[alert show];
[alert changeBackground];
- (void)changeBackground{
for (UIView *view in [self subviews]) {
if ([view isKindOfClass:[UIImageView class]]) {
UIImage *image = [UIImage imageNamed:@"5-1.png"];
UIImageView *back = (UIImageView *)view;
back.image = image;
break;
}
}
}
调用方式:
UIAlertView *alert = [[UIAlertView
alloc]initWithTitle:@"a"
message:nil
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil,
nil];
[alert show];
[alert changeBackground];
相关文章推荐
- [ios] 自定义UIAlertView样式,实现可替换背景和按钮 【转】
- IOS】自定义UIAlertView样式,实现可替换背景和按钮 此博文包含图片此博文包含视频 (2012-10-24 10:23:25)
- 【IOS】自定义UIAlertView样式,实现可替换背景和按钮
- 自定义UIAlertView样式,实现可替换背景和按钮
- 自定义UIAlertView样式,实现可替换背景和按钮
- 【IOS】自定义UIAlertView样式,实现可替换背景和按钮
- IOS自定义UIAlertView样式,实现可替换背景和按钮
- 【IOS】自定义UIAlertView样式,实现可替换背景和按钮
- IOS自定义UIAlertView样式,实现可替换背景和按钮
- 自定义 UIAlertVIew 背景
- 关于自定义UIAlertView背景的方法收集
- 自定义UIAlertView样式,实现可替换背景和按钮
- [ios] 自定义UIAlertView样式,实现可替换背景和按钮 【转】
- 【IOS】自定义UIAlertView样式,实现可替换背景和按钮
- 【IOS】自定义UIAlertView样式,实现可替换背景和按钮
- 自定义 UIAlertView 之 BSYAlertView
- 自定义Textview背景 -------》shape 各属性含义
- iOS开发之如何自定义UIActionSheet(UIAlertView)中的内容
- 简约风格应用中UIAlertView到底要不要自定义
- 自定义UIAlertView、UIActionSheet,高仿系统UIAlertView、UIActionSheet