社区
iOS
帖子详情
UIView调用addSubview后怎么立即显示??
southbirdfly
2012-07-24 04:32:47
貌似要等下一个runloop才会显示?
...全文
530
5
打赏
收藏
UIView调用addSubview后怎么立即显示??
貌似要等下一个runloop才会显示?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
fushaobing
2012-07-25
打赏
举报
回复
你把你的耗时操作放到另外一个线程中去,这样你addSubview过后马上就会显示出来.
southbirdfly
2012-07-24
打赏
举报
回复
[Quote=引用 3 楼 的回复:]
试试这样行不
[view setNeedsDisplay];
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate date]];
[/Quote]
加上这两句,然后我在两个页面间不断快速切换,松开手后还能看到这两个页面切换了几次才停下来。。。怎么会这样的?
巴依老爷
2012-07-24
打赏
举报
回复
试试这样行不
[view setNeedsDisplay];
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode beforeDate: [NSDate date]];
southbirdfly
2012-07-24
打赏
举报
回复
[Quote=引用 1 楼 的回复:]
等你这个addSubview所在的函数里面的所有语句执行完了才会显示.
[/Quote]
有没有办法立即显示?
fushaobing
2012-07-24
打赏
举报
回复
等你这个addSubview所在的函数里面的所有语句执行完了才会显示.
ios-DCHChangeStateButton.zip
自定义一个菜单按钮,通过切换按钮状态,对列表数据进行排序,直接
调用
即可 for (int i = 0; i < titleArr.count; i ) {
UI
View
*
view
= [[
UI
View
alloc] initWithFrame:CGRectMake(i*width, 64, width, 40)];
view
.backgroundColor = [UIColor orangeColor]; DCHChangeStateButton *c sharePriceSortBtntitle:titleArr color:[UIColor whiteColor] font:[UIFont systemFontOfSize:14] target:self action:@selector(changeStateAction:)]; CGFloat btnW = [self calculateWidth:titleArr fontsize:14 labelH:88*mh] 28; conditionBtn.frame = CGRectMake(0, 0, btnW, 88*mh); conditionBtn.centerX =
view
.width*0.5; conditionBtn.centerY =
view
.height*0.5; conditionBtn.tag = i 1; [
view
add
Sub
view
:conditionBtn]; [self.
view
add
Sub
view
:
view
]; [self.btnArr
add
Object:conditionBtn]; }
ios-datePicker
View
.zip
-(void)creatDatePicker { __weak Next
View
Controller * weakself=self; self.datePicker =[[[NSBundle mainBundle] loadNibNamed:@"DatePicker
View
" owner:self options:0] lastObject]; self.datePicker.frame =CGRectMake(0, self.
view
.frame.size.height-260, self.
view
.frame.size.width, 260); self.datePicker.Datetitle =@"日期选择"; self.datePicker.cancelBlock = ^{ [
UI
View
animateWithDuration:5 animations:^{ [weakself.datePicker removeFromSuper
view
]; }]; }; self.datePicker.sureBlock = ^(NSString *selectDateStr) { [weakself.showDateLabel setText:selectDateStr]; [
UI
View
animateWithDuration:5 animations:^{ [weakself.datePicker removeFromSuper
view
]; }]; }; [self.
view
add
Sub
view
:self.datePicker]; } 哪里需要直接
调用
此方法即可
SwiftHSVColorPicker:使用Swift编写的适用于iOS的简单HSV颜色选择器
SwiftHSVColorPicker 描述 使用Swift制作的适用于iOS的简单HSV颜色选择器。 包括“色相和饱和度”轮,“亮度”滑块和用于
显示
所选颜色的
UI
View
。 安装 手动的: Copy the contents of "Source" to your project. CocoaPods: pod 'SwiftHSVColorPicker' 如何使用 将子类“ SwiftHSVColorPicker”的
UI
View
添加到您的情节提要或以编程方式创建它: let colorPicker = SwiftHSVColorPicker ( frame : CGRectMake ( 10 , 20 , 300 , 400 )) self .
view
.
add
Sub
view
(colorPicker) 将颜色选择器添加到项目后,通过
调用
以下命令初始化SwiftHSVCol
iOS自定义水平滚动条、进度条
iOS自定义水平滚动条、进度条,继承
UI
View
,可点击轨道、滑动滑块交互。 先看一下效果图: 简单说一下逻辑,新建一个继承
UI
View
的类,分别给轨道、滑块添加UITapGestureRecognizer点击、UIPanGestureRecognizer滑动手势。获取偏移量,计算控件位置,刷新视图。 下面贴上核心代码:
显示
视图,在控制器
调用
代码: HWSlider *slider = [[HWSlider alloc] initWithFrame:CGRectMake(10, 50, 300, 75)]; [self.
view
add
Sub
view
:slider]; HWSlider:
JHSpinner:适用于iOS的独特的动画加载微调器活动指示器
UI
View
子类
JHSpinner 用法 要运行示例项目,请克隆存储库,然后首先从Example目录运行pod install 。 要使用JHSpinner,只需
调用
JHSpinner
View
.showOn
View
(...函数。可以使用各种可选参数来自定义功能,例如叠加层类型,颜色,微调器动画速度和文本。 圆角正方形: let spinner = JHSpinner
View
. showOn
View
(
view
, spinnerColor :UIColor. redColor (), overlay :. RoundedSquare , overlayColor :UIColor. blackColor (). colorWithAlphaComponent ( 0.6 ))
view
.
add
Sub
view
(spinner) 正方形: let spinner = JHSpin
iOS
29,031
社区成员
12,466
社区内容
发帖
与我相关
我的任务
iOS
主要讨论与iOS相关的软件和技术
复制链接
扫一扫
分享
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章