在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):bfeher/BFPaperButton开源软件地址(OpenSource Url):https://github.com/bfeher/BFPaperButton开源编程语言(OpenSource Language):Objective-C 98.8%开源软件介绍(OpenSource Introduction):BFPaperButton
AboutNow with smoother animations and more public properties for even easier customization!BFPaperButton is a subclass of UIButton that behaves much like the new paper buttons from Google's Material Design Labs. All animation are asynchronous and are performed on sublayers. BFPaperButtons work right away with pleasing default behaviors, however they can be easily customized! The corner radius, tap-circle color, background fade color, and tap-circle diameter are all readily customizable via public properties. BFPaperButtons come in 2 flavors, Flat or Raised. Flat BFPaperButtons have no shadow and will remain flat through all animations. Flat buttons can be transparent, in which case the background will also fade a little when tapped. Raised BFPaperButtons have a drop shadow that animates along with a tap, giving it the feeling of raising up with your touch. Raised BFPaperButtons do not look good with a clear background color since it will expose their shadow layer underneath. By default, BFPaperButtons use "Smart Color" which will match the tap-circle and background fade colors to the color of the Note that setting the button type to Custom in the Storyboard is required to prevent the title from fading out on UIControlStateHighlighted. Properties
Notes on RAISED vs FLAT and SMART COLOR vs NON SMART COLOR:RAISEDHas a shadow, so a clear background will look silly. It has only a tap-circle color. No background-fade. FLATHas no shadow, therefore clear backgrounds look fine. If the background is clear, it also has a background-fade color to help visualize the button and its frame. SMART COLORWill use the titleLabel's font color to pick a tap circle color and, if the background is clear, will also pick a lighter background fade color. NON SMART COLORWill use a translucent gray tap-circle and, if the background is clear, a lighter translucent gray background-fade color. UsageAdd the BFPaperButton header and implementation file to your project. (.h & .m) Creating a Flat BFPaperButtonBFPaperButton *flatPaperButton = [[BFPaperButton alloc] initWithFrame:rect raised:NO]; Creating a Raised BFPaperButtonBFPaperButton *raisedPaperButton = [[BFPaperButton alloc] initWithFrame:rect raised:YES]; Working Example(Taken directly from example project.) BFPaperButton *bfFlatSmart = [[BFPaperButton alloc] initWithFrame:CGRectMake(20, 20, 280, 43) raised:NO];
[bfFlatSmart setTitle:@"BFPaperButton Flat: Smart Color" forState:UIControlStateNormal];
bfFlatSmart.backgroundColor = [UIColor paperColorGray600]; // You can find this from my other library, BFPaperColors :)
[bfFlatSmart setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[bfFlatSmart setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
[bfFlatSmart addTarget:self action:@selector(buttonWasPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:bfFlatSmart]; Customized Example(Taken directly from example project.) BFPaperButton *circle2 = [[BFPaperButton alloc] initWithFrame:CGRectMake(116, 468, 86, 86) raised:YES];
[circle2 setTitle:@"Custom" forState:UIControlStateNormal];
[circle2 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[circle2 setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
[circle2 addTarget:self action:@selector(buttonWasPressed:) forControlEvents:UIControlEventTouchUpInside];
circle2.backgroundColor = [UIColor colorWithRed:0.3 green:0 blue:1 alpha:1];
circle2.tapCircleColor = [UIColor colorWithRed:1 green:0 blue:1 alpha:0.6]; // Setting this color overrides "Smart Color".
circle2.cornerRadius = circle2.frame.size.width / 2;
circle2.rippleFromTapLocation = NO;
circle2.rippleBeyondBounds = YES;
circle2.tapCircleDiameter = MAX(circle2.frame.size.width, circle2.frame.size.height) * 1.3;
[self.view addSubview:circle2]; CocoaPodsCocoaPods are the best way to manage library dependencies in Objective-C projects. Learn more at http://cocoapods.org Add this to your podfile to add BFPaperButton to your project. platform :ios, '7.0'
pod 'BFPaperButton' LicenseBFPaperButton uses the MIT License:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论