| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,6 +100,7 @@ | |||
| 100 | 100 | #define kHigher_iOS_6_1_DIS(_X_) ([[NSNumber numberWithBool:kHigher_iOS_6_1] intValue] * _X_) | |
| 101 | 101 | #define kNotHigher_iOS_6_1_DIS(_X_) (-([[NSNumber numberWithBool:kHigher_iOS_6_1] intValue]-1) * _X_) | |
| 102 | 102 | ||
| 103 | + #define kDevice_Is_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO) | ||
| 103 | 104 | #define kDevice_Is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 104 | 105 | #define kDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO) | |
| 105 | 106 | #define kDevice_Is_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,11 @@ @interface PointRecordsViewController ()<UITableViewDataSource, UITableViewDeleg | |||
| 23 | 23 | ||
| 24 | 24 | @property (nonatomic, strong) UITableView *myTableView; | |
| 25 | 25 | @property (nonatomic, strong) ODRefreshControl *refreshControl; | |
| 26 | + @property (strong, nonatomic) UIButton *rightNavBtn; | ||
| 27 | + @property (assign, nonatomic) BOOL isShowingTip; | ||
| 28 | + @property (strong, nonatomic) UIView *tipContainerV; | ||
| 29 | + @property (strong, nonatomic) UIImageView *tipBGV; | ||
| 30 | + @property (strong, nonatomic) UILabel *tipL; | ||
| 26 | 31 | @end | |
| 27 | 32 | ||
| 28 | 33 | @implementation PointRecordsViewController | |
@@ -51,13 +56,23 @@ - (void)viewDidLoad | |||
| 51 | 56 | _refreshControl = [[ODRefreshControl alloc] initInScrollView:self.myTableView]; | |
| 52 | 57 | [_refreshControl addTarget:self action:@selector(refresh) forControlEvents:UIControlEventValueChanged]; | |
| 53 | 58 | ||
| 59 | + _rightNavBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 40, 40)]; | ||
| 60 | + [_rightNavBtn addTarget:self action:@selector(rightNavBtnClicked) forControlEvents:UIControlEventTouchUpInside]; | ||
| 61 | + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:_rightNavBtn]; | ||
| 62 | + self.isShowingTip = NO; | ||
| 63 | + | ||
| 54 | 64 | __weak typeof(self) weakSelf = self; | |
| 55 | 65 | [_myTableView addInfiniteScrollingWithActionHandler:^{ | |
| 56 | 66 | [weakSelf refreshMore]; | |
| 57 | 67 | }]; | |
| 58 | 68 | [self refresh]; | |
| 59 | 69 | } | |
| 60 | 70 | ||
| 71 | + - (void)setIsShowingTip:(BOOL)isShowingTip{ | ||
| 72 | + _isShowingTip = isShowingTip; | ||
| 73 | + [_rightNavBtn setImage:[UIImage imageNamed:_isShowingTip? @"tip_selected_Nav": @"tip_normal_Nav"] forState:UIControlStateNormal]; | ||
| 74 | + } | ||
| 75 | + | ||
| 61 | 76 | - (void)refresh{ | |
| 62 | 77 | if (_curRecords.isLoading) { | |
| 63 | 78 | return; | |
@@ -163,4 +178,62 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath | |||
| 163 | 178 | } | |
| 164 | 179 | } | |
| 165 | 180 | ||
| 181 | + #pragma mark rightNavBtn | ||
| 182 | + - (void)rightNavBtnClicked{ | ||
| 183 | + CGRect originFrame = CGRectMake(kScreen_Width - 15, 0, 0, 0); | ||
| 184 | + if (_isShowingTip) { | ||
| 185 | + [UIView animateWithDuration:0.3 animations:^{ | ||
| 186 | + self.tipContainerV.backgroundColor = [UIColor colorWithWhite:0 alpha:0]; | ||
| 187 | + self.tipBGV.frame = originFrame; | ||
| 188 | + } completion:^(BOOL finished) { | ||
| 189 | + [self.tipContainerV removeFromSuperview]; | ||
| 190 | + self.isShowingTip = NO; | ||
| 191 | + }]; | ||
| 192 | + }else{ | ||
| 193 | + NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; | ||
| 194 | + paragraphStyle.lineSpacing = kDevice_Is_iPhone4? 0: 5; | ||
| 195 | + if (!_tipContainerV) { | ||
| 196 | + _tipContainerV = [[UIView alloc] initWithFrame:self.view.bounds]; | ||
| 197 | + } | ||
| 198 | + if (!_tipBGV) { | ||
| 199 | + _tipBGV = [[UIImageView alloc] initWithImage:[[UIImage imageNamed:@"tip_bg"] resizableImageWithCapInsets:UIEdgeInsetsMake(20, 15, 20, 30) resizingMode:UIImageResizingModeStretch]]; | ||
| 200 | + _tipBGV.frame = originFrame; | ||
| 201 | + _tipBGV.clipsToBounds = YES; | ||
| 202 | + [_tipContainerV addSubview:_tipBGV]; | ||
| 203 | + } | ||
| 204 | + if (!_tipL) { | ||
| 205 | + _tipL = [UILabel new]; | ||
| 206 | + _tipL.textColor = [UIColor colorWithHexString:@"0x222222"]; | ||
| 207 | + _tipL.font = [UIFont systemFontOfSize:14]; | ||
| 208 | + _tipL.numberOfLines = 0; | ||
| 209 | + NSString *tipStr = | ||
| 210 | + @"1. 使用人民币 兑换 (请通过点击账户码币页面的”购买码币”,以充值的形式购买码币。码币与人民币的兑换标准是 1 码币= 50 元人民币(0.1 码币起购买),支持支付宝及微信付款)\n\ | ||
| 211 | + 2. 冒泡 被管理员推荐上广场 奖励 0.01\n\ | ||
| 212 | + 3. 邀请好友 注册 Coding 并绑定手机号 奖励 0.02mb\n\ | ||
| 213 | + 4. 过生日赠送 0.1mb\n\ | ||
| 214 | + 5. 完善 个人信息 奖励 0.1mb\n\ | ||
| 215 | + 6. 完成 手机验证 奖励 0.1mb\n\ | ||
| 216 | + 7. 开启 两步验证 奖励 0.1mb\n\ | ||
| 217 | + 8. App 首次登录 奖励 0.1mb\n\ | ||
| 218 | + 9. 我们不定期发布的其他形式的码币悬赏活动(请关注 Coding冒泡,Coding微博 及 Coding微信公众号),数量不等\n\ | ||
| 219 | + 10. 转发 Coding微博,每周抽 1 名转发用户赠送 0.5mb\n\ | ||
| 220 | + 11. 给 Coding 博客 投稿 奖励 1-2mb"; | ||
| 221 | + NSMutableAttributedString *tipAttrStr = [[NSMutableAttributedString alloc] initWithString:tipStr]; | ||
| 222 | + [tipAttrStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, tipStr.length)]; | ||
| 223 | + _tipL.attributedText = tipAttrStr; | ||
| 224 | + _tipL.frame = CGRectMake(15, 40, kScreen_Width - 15 * 4, 0); | ||
| 225 | + [_tipBGV addSubview:_tipL]; | ||
| 226 | + } | ||
| 227 | + CGFloat textHeight = [_tipL.text boundingRectWithSize:CGSizeMake(kScreen_Width - 15 * 4, CGFLOAT_MAX) options:(NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSParagraphStyleAttributeName: paragraphStyle, NSFontAttributeName: _tipL.font} context:nil].size.height; | ||
| 228 | + _tipL.height = textHeight; | ||
| 229 | + [self.view addSubview:self.tipContainerV]; | ||
| 230 | + [UIView animateWithDuration:0.3 animations:^{ | ||
| 231 | + self.tipContainerV.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3]; | ||
| 232 | + self.tipBGV.frame = CGRectMake(15, 0, kScreen_Width - 15 * 2, textHeight + 40 + 30); | ||
| 233 | + } completion:^(BOOL finished) { | ||
| 234 | + self.isShowingTip = YES; | ||
| 235 | + }]; | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + | ||
| 166 | 239 | @end | |
| Back | FazBrowse Home | New Git URL |
0 commit comments