how to make round buttons like the iOS 7 lock screen

泪湿孤枕 提交于 2019-12-21 20:22:50

问题


Is there a predefined widget to make have round buttons in iOS7 like with the lock screen? I've been looking around at UIButton but I couldn't find anything. So their they're not UIButtons, or I'm not seeing it, or they just don't exist and I have to make my own custom buttons.


回答1:


Link the framework in build steps then

Import:

#import QuartzCore/QuartzCore.h

Code:

self.fiveButton.layer.cornerRadius = self.fiveButton.bounds.size.width/2.0;
self.fiveButton.layer.borderWidth = 1.0;
self.fiveButton.layer.borderColor = self.fiveButton.titleLabel.textColor.CGColor;
self.fiveButton.titleLabel.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:35];

This isn't exactly right: I don't have the label moved up (there are inserts for that) and I haven't figured out the exact font, but it's almost there.

https://github.com/langford/RoundButtonDemo/blob/master/screenshot.png

git@github.com:langford/RoundButtonDemo.git



来源:https://stackoverflow.com/questions/20497860/how-to-make-round-buttons-like-the-ios-7-lock-screen

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