UIVIEw *vIEw = [self vIDeoPrevIEwVIEw]; CGRect bounds = [[self vIDeoPrevIEwVIEw] bounds]; //bounds gets set here //values are same as below [self setCaptureManager:captureManager]; AVCaptureVIDeoPrevIEwLayer *captureVIDeoPrevIEwLayer = [[AVCaptureVIDeoPrevIEwLayer alloc] initWithSession:[captureManager session]]; CALayer *vIEwLayer = [vIEw layer]; [vIEwLayer setMasksToBounds:YES]; [captureVIDeoPrevIEwLayer setFrame:bounds]; //Use autolayout off: x=0,y=0,wIDth=320,height=504 //Use autolayout on: x=0,wIDth=0,height=0
谢谢.
解决方法 启用autolayout后,尚未在vIEwDIDLoad中计运算符视图约束,从而导致帧等于CGRectZero.您应该将帧设置代码移动到vIEwDIDLayoutSubvIEws方法中.从类引用解释vIEwDIDLayoutSubvIEws:
NotifIEs the vIEw controller that its vIEw just laID out its subvIEws.
正是在autolayout完成其工作以计算约束并将子视图放在适当位置之后.
总结以上是内存溢出为你收集整理的ios – 目标C:自动布局,现有自定义视图将边界宽度和高度更改为0,0全部内容,希望文章能够帮你解决ios – 目标C:自动布局,现有自定义视图将边界宽度和高度更改为0,0所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)