项目介绍:
自定义弹出视图,附带弹性动画效果,分享到朋友圈。本Demo采用代理协议传值的方式。相互学习。
主要分享代码:
[Objective-C] 查看源文件 复制代码
#import "ViewController.h"
#import "XFPublishView.h"
@interface ViewController ()<XFPublishViewDelegate>
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIButton * btn =[UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(100, 100,100, 40);
[btn setTitle:@"分享" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(shareBtnClick) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
-(void)shareBtnClick
{
XFPublishView *publishView = [[XFPublishView alloc]initWithFrame:[UIScreen mainScreen].bounds];
publishView.delegate = self;
[publishView show ];
}
-(void)didSelectBtnWithBtnTag:(NSInteger)tag
{
if (tag==1)
{
NSLog(@"111");
}else if (tag==2)
{
NSLog(@"222");
}else{
NSLog(@"CLOSE");
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
