如何用angular上的closuresbutton创build视图?

你通常用左上angular的button创build视图以创build类似于图片中显示的视图?

我是否只需将图像放在angular落的button? 或者有一些最好的实践? :) 就是想。

查看与关闭按钮在角落里

你将把button的偏移量设置为-10 (如果你的button大约是30×30) X和Y.

在你的例子中,这看起来像Pro Switcher ,只要看看那里的源代码,看看他是如何做到的。

检查由马特Gemmell写他的“collections夹”应用程序的UIdevise。 他具体讨论那些“closures”button。

collections夹UIdevise

在父vie创buildbutton,并设置其框架接近你的子视图

 button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown]; button.backgroundColor = [UIColor clearColor]; [button setBackgroundImage:[UIImage imageNamed:@"close_button.png"] forState:UIControlStateNormal]; button.frame = CGRectMake(0, 80, 30, 30); [self.view addSubview:button];