Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 将UIVIew作为子视图添加到窗口的右下角_Iphone_Ios - Fatal编程技术网

Iphone 将UIVIew作为子视图添加到窗口的右下角

Iphone 将UIVIew作为子视图添加到窗口的右下角,iphone,ios,Iphone,Ios,目前我有一个UIView,大小为100px宽,40px高。如果我使用 [self.view addSubView:buttonsView] 它将这个小视图添加到我的iPhone屏幕的左上角 是否有办法将其添加到右下角?在添加按钮视图之前,请设置其“frame”属性: 单向: buttonsView.frame = CGRectMake( self.view.frame.size.width - buttonsView.frame.size.width, self.view.frame.si

目前我有一个
UIView
,大小为100px宽,40px高。如果我使用

[self.view addSubView:buttonsView]

它将这个小视图添加到我的iPhone屏幕的左上角


是否有办法将其添加到右下角?

在添加按钮视图之前,请设置其“frame”属性:

单向:

buttonsView.frame = CGRectMake( 
 self.view.frame.size.width - buttonsView.frame.size.width,
 self.view.frame.size.height - buttonsView.frame.size.height,
 buttonsView.frame.size.width,
 buttonsView.frame.size.height );

或者使用autoresizingMask。。还有烦人的算术。。