V2EX yoki
 yoki 最近的时间轴更新
yoki

yoki

V2EX 第 37912 号会员,加入于 2013-04-21 21:50:59 +08:00
yoki 最近回复了
你好 之前也遇到过这样的问题 来说一下我的解决办法

自动布局是会在更新视图的时候同步更新frame bounds的 然而有时候我们在代码中获取的时候却得到{(0,0),(0,0)} 或者各种奇怪的结果 这是因为在你用代码获取frame的时候系统还没有更新你的layout

楼上的朋友@dorentus 提供的解决方案应该是可行的 因为在viewWillAppear中一般的视图都更新完layout了 应该是可以获取到的

但是有时候我们想在任意函数中获取怎么办呢

解决方案是在获取之前加上一句[myDemoView layoutIfNeeded];



```
[myDemoView layoutIfNeeded];

NSLog("frame:%@",NSStringFromRect(myDemoView.frame));
```

这个回复是我在PC上打的 拼写也许有错误 希望能帮到你
分享解决了我这个问题的一个帖子:
If you open the Activity Monitor and see that a process called "google chrome helper" is using too much CPU, here's how I fixed it:

I went to Chrome settings/content settings/Plugins and selected Click To Play for all plugins. (The default is Run Automatically.)

This fixed my problem. Now you have to click whenever you want to run a youtube video or other plugins, but it's worth it. It stops those stupid Flash ads from loading, too, so that's an extra bonus.

I'm posting this because when I had the problem, I couldn't find any solutions at all.

就是隐私下面那个“内容设置”点进去 将插件设置成点击运行就好 flash的广告也顺带屏蔽了
我的chrome已经这样好久了 最近发现iPhoto也出现了这样的问题 看来是系统的bug
关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     953 人在线   最高记录 6679       Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 11ms UTC 19:38 PVG 03:38 LAX 12:38 JFK 15:38
Do have faith in what you're doing.
ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86