// // PromoteController.m // model // // Created by Drew on 2018/10/29. // Copyright © 2018 Mine. All rights reserved. // #import "PromoteController.h" #import "ShareViewController.h" #import "ChooseShareController.h" #import "MyTeamController.h" @interface PromoteController () @property (weak, nonatomic) IBOutlet UILabel *rewardLabel; @property (weak, nonatomic) IBOutlet UILabel *descLabel; @property (weak, nonatomic) IBOutlet UIView *contentView; @end @implementation PromoteController - (void)viewDidLoad { [super viewDidLoad]; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(0, 0, 40, 40); UIImage *image = [[UIImage imageNamed:@"backBtn"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [btn setImage:image forState:UIControlStateNormal]; btn.imageEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0); btn.tintColor = [UIColor whiteColor]; [btn addTarget:self action:@selector(backClick) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *leftItem = [[UIBarButtonItem alloc] initWithCustomView:btn]; UIBarButtonItem *nagetiveSpacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; nagetiveSpacer.width = -12;//这个值可以根据自己需要自己调整 self.navigationItem.leftBarButtonItems = @[nagetiveSpacer, leftItem]; UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"推广明细" style:UIBarButtonItemStylePlain target:self action:@selector(detail)]; [rightBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:16],NSFontAttributeName, nil] forState:UIControlStateNormal]; [rightBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIFont boldSystemFontOfSize:16],NSFontAttributeName, nil] forState:UIControlStateSelected]; [rightBtn setTintColor:[UIColor whiteColor]]; self.navigationItem.rightBarButtonItem = rightBtn; NSString *str = @"用户端\n1:所有用户都可参与推广奖励\n2:通过分享自己的专属“推广链接”或“二维码”下载千模通告及注册的用户,才算做“我的推广用户”\n3:用户充值分成比例为10%\n4:分成金额可用于提现或兑换服务\n\n模特端\n1:推荐并通过审核以后,总数达到30人以上,即可申请成为“经纪人”\n2:经纪人享有所有推荐模特视频面试交易金额的10%作为奖励及其他奖励\n3:奖励可用于提现或购买平台服务"; NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:str]; [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:[str rangeOfString:@"用户端"]]; [attrStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:[str rangeOfString:@"模特端"]]; NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineSpacing:2]; [attrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, str.length)]; self.descLabel.attributedText = attrStr; } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; self.navigationController.navigationBar.barStyle = UIBarStyleBlack; [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]]; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.navigationController.navigationBar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:nil]; self.navigationController.navigationBar.barStyle = UIBarStyleDefault; } - (void)viewDidLayoutSubviews { CAGradientLayer *gl = [CAGradientLayer layer]; gl.frame = self.view.bounds; gl.startPoint = CGPointMake(0.5, 0); gl.endPoint = CGPointMake(0.5, 0.98); gl.colors = @[(__bridge id)[UIColor colorWithRed:251/255.0 green:92/255.0 blue:163/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:253/255.0 green:127/255.0 blue:141/255.0 alpha:1].CGColor]; gl.locations = @[@(0), @(1.0f)]; [self.view.layer insertSublayer:gl atIndex:0]; // gradient CAGradientLayer *gl1 = [CAGradientLayer layer]; gl1.frame = self.contentView.bounds; gl1.startPoint = CGPointMake(0.5, 0); gl1.endPoint = CGPointMake(0.5, 0.97); gl1.colors = @[(__bridge id)[UIColor colorWithRed:255/255.0 green:216/255.0 blue:134/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:252/255.0 green:136/255.0 blue:149/255.0 alpha:1].CGColor]; gl1.locations = @[@(0), @(1.0f)]; self.contentView.layer.cornerRadius = 24; self.contentView.clipsToBounds = YES; [self.contentView.layer insertSublayer:gl1 atIndex:0]; } - (void)backClick { [self.navigationController popViewControllerAnimated:YES]; } - (void)detail { MyTeamController *vc = [[MyTeamController alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } - (IBAction)withdraw:(id)sender { } - (IBAction)transfer:(id)sender { } - (IBAction)invite:(id)sender { ChooseShareController* vc = [[ChooseShareController alloc] init]; vc.delegate = self; [self.tabBarController presentViewController:vc animated:NO completion:nil]; } -(void)shareMember{ ShareViewController *vc = [[ShareViewController alloc] init]; vc.hidesBottomBarWhenPushed = YES; vc.type = 1; [self.navigationController pushViewController:vc animated:YES]; } -(void)shareModel{ ShareViewController *vc = [[ShareViewController alloc] init]; vc.hidesBottomBarWhenPushed = YES; vc.type = 2; [self.navigationController pushViewController:vc animated:YES]; } @end