To run the example project, clone the repo, and run pod install from the Example directory first.
PNKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PNKit'
P1nov, [email protected]. WeChat:Fyair000
PNKit is available under the MIT license. See the LICENSE file for more info.
Use like UITableView. It has two protocol, you should implement two of those functions in where you used it
- (NSInteger)numberOfImageInCarouselView;
- (UIImage *)carouselViewImageInEachIndex:(NSInteger)index;
there is a category for UIColor, I turn the hex number for UIColor, so you can only use
+ (UIColor *)colorWithRGB:(unsigned int)hex;
to set color you want!
It is a pop over view , you can use it for a pop list !
It has two object you must use : PNRowAction and PNRowActionConfig, you should add RowAction in the PNPopoverView and there is a block for click event.
+ (PNRowAction *)actionWithConfig:(PNRowActionConfig *)config
handler:(PNRowActionHandler)handler;
The most useful thing is that you can set the arrow's direction
typedef NS_ENUM(NSUInteger,PNArrowDirection){
//箭头位置
PNArrowDirectionLeftUp=1,//左上
PNArrowDirectionLeftMiddle,//左中
PNArrowDirectionLeftDown,//左下
PNArrowDirectionRightUp,//右上
PNArrowDirectionRightMiddle,//右中
PNArrowDirectionRightDown,//右下
PNArrowDirectionUpLeft,//上左
PNArrowDirectionUpMiddle,//上中
PNArrowDirectionUpRight,//上右
PNArrowDirectionDownLeft,//下左
PNArrowDirectionDownMiddle,//下中
PNArrowDirectionDownRight,//下右
};
_popoverView = [[PNPopoverView alloc] initWithOrigin:CGPointMake(200, 300) width:100 direction:PNArrowDirectionUpRight];
PNRowActionConfig *config1 = [PNRowActionConfig configWithTitle:@"title1" icon:nil font:nil color:nil];
PNRowAction *action1 = [PNRowAction actionWithConfig:config1 handler:^(PNRowAction * _Nonnull action) {
NSLog(@"第1个action");
}];
PNRowActionConfig *config2 = [PNRowActionConfig configWithTitle:@"title2" icon:nil font:nil color:nil];
PNRowAction *action2 = [PNRowAction actionWithConfig:config2 handler:^(PNRowAction * _Nonnull action) {
NSLog(@"第2个action");
}];
PNRowActionConfig *config3 = [PNRowActionConfig configWithTitle:@"title3" icon:nil font:nil color:nil];
PNRowAction *action3 = [PNRowAction actionWithConfig:config3 handler:^(PNRowAction * _Nonnull action) {
NSLog(@"第3个action");
}];
_popoverView.rowActions = [NSMutableArray arrayWithArray:@[action1, action2, action3]];