如何创建自定义的圆形UiView和UIButton

如何创建自定义的圆形UiView和UIButton

本文介绍了如何创建自定义的圆形UiView和UIButton(如MobilePASS)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想像此应用程序一样创建带有圆角和UIButton的类似UIView.我可以在Interface Builder上实现它吗?

I want to create a similar UIView with rounded corner and UIButton just like this app.Can I implement this on Interface Builder?

推荐答案

只需在代码中包含QuartzCore框架,就可以在拐角处设置边界并在代码中设置边框.

You can round the corners and set a border in code, just make sure you have QuartzCore framework included.

-(void) viewDidLoad {
    [super viewDidLoad];

    self.welcomeView.layer.cornerRadius = 5;
    self.welcomeView.layer.borderWidth = 2;
    self.welcomeView.layer.borderColor = [[UIColor whiteColor] CGColor];

}

然后只是布置您的视图并在IB中设置您的网点.那应该可以让您进入Quartz中很多很棒的东西.

Then just lay out your views and setup your outlets in IB. That should get you going, lots of cool stuff in Quartz.

此处是指向API参考 http://developer.apple.com/library/mac/ipad/#documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40004500

Here is a link to the API reference http://developer.apple.com/library/mac/ipad/#documentation/graphicsimaging/reference/CALayer_class/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40004500

这篇关于如何创建自定义的圆形UiView和UIButton(如MobilePASS)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 10:16