@@ -23,6 +23,11 @@ @interface PointRecordsViewController ()<UITableViewDataSource, UITableViewDeleg
2323
2424@property (nonatomic , strong ) UITableView *myTableView;
2525@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;
2631@end
2732
2833@implementation PointRecordsViewController
@@ -51,13 +56,23 @@ - (void)viewDidLoad
5156 _refreshControl = [[ODRefreshControl alloc ] initInScrollView: self .myTableView];
5257 [_refreshControl addTarget: self action: @selector (refresh ) forControlEvents: UIControlEventValueChanged];
5358
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+
5464 __weak typeof (self) weakSelf = self;
5565 [_myTableView addInfiniteScrollingWithActionHandler: ^{
5666 [weakSelf refreshMore ];
5767 }];
5868 [self refresh ];
5969}
6070
71+ - (void )setIsShowingTip : (BOOL )isShowingTip {
72+ _isShowingTip = isShowingTip;
73+ [_rightNavBtn setImage: [UIImage imageNamed: _isShowingTip? @" tip_selected_Nav" : @" tip_normal_Nav" ] forState: UIControlStateNormal];
74+ }
75+
6176- (void )refresh {
6277 if (_curRecords.isLoading ) {
6378 return ;
@@ -163,4 +178,62 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
163178 }
164179}
165180
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+
166239@end
0 commit comments