基于IOS实现带箭头的view

2020-01-15 18:34:25王旭

使用


@interface ViewController ()<selectIndexPathDelegate>

##你可以在btn的点击方法里这样写


// 支持多种类型
/**
XTTypeOfUpLeft,  // 上左
XTTypeOfUpCenter, // 上中
XTTypeOfUpRight, // 上右

XTTypeOfDownLeft, // 下左
XTTypeOfDownCenter, // 下中
XTTypeOfDownRight, // 下右

XTTypeOfLeftUp,  // 左上
XTTypeOfLeftCenter, // 左中
XTTypeOfLeftDown, // 左下

XTTypeOfRightUp, // 右上
XTTypeOfRightCenter,// 右中
XTTypeOfRightDown, // 右下
*/

CGPoint point = CGPointMake(_customBtn.center.x,_customBtn.frame.origin.y + 64);
XTPopView *view1 = [[XTPopView alloc] initWithOrigin:point Width:130 Height:40 * 4 Type:XTTypeOfUpRight Color:[UIColor colorWithRed:0.2737 green:0.2737 blue:0.2737 alpha:1.0]];
view1.dataArray = @[@"发起群聊",@"添加朋友", @"扫一扫", @"收付款"];
view1.images = @[@"发起群聊",@"添加朋友", @"扫一扫", @"付款"];
view1.fontSize = 13;
view1.row_height = 40;
view1.titleTextColor = [UIColor whiteColor];
view1.delegate = self;
[view1 popView];

##想要使用点击方法 只要实现协议的方法就可以了


- (void)selectIndexPathRow:(NSInteger)index
{
switch (index) {
case 0:
{
NSLog(@"Click 0 ......");
}
break;
case 1:
{
NSLog(@"Clikc 1 ......");
}
break;
case 2:
{
NSLog(@"Clikc 2 ......");
}
break;
case 3:
{
NSLog(@"Clikc 3 ......");
}
break;
default:
break;
}
}

总结

以上就是基于IOS实现带箭头的view的全部内容,希望对大家开发IOS能有所帮助。


注:相关教程知识阅读请移步到IOS开发频道。