Make view cover full screen using CGRectMake

自古美人都是妖i 提交于 2019-12-04 04:04:35

问题


I'm creating a view (using card.io), and I want the view to cover the full screen.

Its only covering about 2/3rds of the screen atm.

Heres the code:

 CardIOView *cardIOView = [[CardIOView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];

Here is an example


回答1:


Dave from card.io here.

When you create a CardIOView, its frame will take on whatever size you set. However, the camera view within the (transparent) CardIOView will have the standard iOS camera form factor of 4:3.

So if the CardIOView is 320 points wide, then its camera view will be ~426 points tall. (You can confirm this by checking the cameraPreviewFrame property of your CardIOView.)

Given this information, you should be able to set the frame of your CardIOView so that the camera image appears where you'd like it to appear onscreen. You will probably want to set the background color of either the CardIOView or of your containing view to black. And you may or may not choose to hide the navigation bar.




回答2:


If you want cover all the screen, it is immediate write something like this:

CardIOView *cardIOView = [[CardIOView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];


来源:https://stackoverflow.com/questions/24340859/make-view-cover-full-screen-using-cgrectmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!