forked from tbl00c/TLChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
181 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
TLChat/Resources/Images/Mine.xcassets/wallet_9_9.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "wallet_9_9.png", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Binary file added
BIN
+57.6 KB
TLChat/Resources/Images/Mine.xcassets/wallet_9_9.imageset/wallet_9_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
TLChat/SRC/Mine/WalletViewController/TLWalletViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// TLWalletViewController.h | ||
// TLChat | ||
// | ||
// Created by 李伯坤 on 16/9/28. | ||
// Copyright © 2016年 李伯坤. All rights reserved. | ||
// | ||
|
||
#import "TLViewController.h" | ||
|
||
@interface TLWalletViewController : TLViewController | ||
|
||
@end |
115 changes: 115 additions & 0 deletions
115
TLChat/SRC/Mine/WalletViewController/TLWalletViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// | ||
// TLWalletViewController.m | ||
// TLChat | ||
// | ||
// Created by 李伯坤 on 16/9/28. | ||
// Copyright © 2016年 李伯坤. All rights reserved. | ||
// | ||
|
||
#import "TLWalletViewController.h" | ||
|
||
@interface TLWalletViewController () <TLActionSheetDelegate> | ||
|
||
@property (nonatomic, strong) UILabel *label; | ||
|
||
@property (nonatomic, strong) UIImageView *imageView; | ||
|
||
@end | ||
|
||
@implementation TLWalletViewController | ||
|
||
- (void)loadView | ||
{ | ||
[super loadView]; | ||
[self setTitle:@"钱包"]; | ||
|
||
UIScrollView *scrollView = [[UIScrollView alloc] init]; | ||
[scrollView setContentSize:CGSizeMake(WIDTH_SCREEN, HEIGHT_SCREEN - HEIGHT_NAVBAR - HEIGHT_STATUSBAR + 0.5)]; | ||
[self.view addSubview:scrollView]; | ||
[scrollView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
make.edges.mas_equalTo(0); | ||
}]; | ||
|
||
self.label = ({ | ||
UILabel *label = [[UILabel alloc] init]; | ||
[label setTextColor:[UIColor grayColor]]; | ||
[label setFont:[UIFont systemFontOfSize:15]]; | ||
[label setNumberOfLines:0]; | ||
label; | ||
}); | ||
[scrollView addSubview:self.label]; | ||
[self.label mas_makeConstraints:^(MASConstraintMaker *make) { | ||
make.top.mas_equalTo(20); | ||
make.centerX.mas_equalTo(0); | ||
make.width.mas_lessThanOrEqualTo(self.view).mas_offset(-30); | ||
}]; | ||
|
||
self.imageView = ({ | ||
UIImageView *imageView = [[UIImageView alloc] init]; | ||
[imageView setUserInteractionEnabled:YES]; | ||
UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressQRCodeImage:)]; | ||
[imageView addGestureRecognizer:longPressGR]; | ||
imageView; | ||
}); | ||
[scrollView addSubview:self.imageView]; | ||
[self.imageView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
make.top.mas_equalTo(self.label.mas_bottom).mas_offset(30); | ||
make.centerX.mas_equalTo(0); | ||
make.size.mas_equalTo(CGSizeMake(375 * 0.7, 422 * 0.7)); | ||
}]; | ||
|
||
UILabel *infoLabel = ({ | ||
UILabel *label = [[UILabel alloc] init]; | ||
[label setTextColor:[UIColor grayColor]]; | ||
[label setFont:[UIFont systemFontOfSize:14]]; | ||
[label setText:@"(长按保存)"]; | ||
label; | ||
}); | ||
[scrollView addSubview:infoLabel]; | ||
[infoLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(10); | ||
make.centerX.mas_equalTo(0); | ||
}]; | ||
} | ||
|
||
- (void)viewDidLoad | ||
{ | ||
[super viewDidLoad]; | ||
[MobClick event:EVENT_WALLET_DONATE]; | ||
[self.label setText:@"如果此份源码对您有足够大帮助,您可以小额赞助我,已激励我继续维护,做得更好。"]; | ||
[self.imageView setImage:[UIImage imageNamed:@"wallet_9_9"]]; | ||
} | ||
|
||
#pragma mark - # Delegate | ||
//MARK: TLActionSheetDelegate | ||
- (void)actionSheet:(TLActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex | ||
{ | ||
if (buttonIndex == 0) { | ||
UIImage *image = self.imageView.image; | ||
UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), NULL); | ||
} | ||
} | ||
|
||
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo | ||
{ | ||
if (error) { | ||
[UIAlertView bk_alertViewWithTitle:@"保存失败" message:[NSString stringWithFormat:@"%@", [error description]]]; | ||
} | ||
else { | ||
[UIAlertView bk_showAlertViewWithTitle:@"保存成功" message:@"谢谢" cancelButtonTitle:@"确定" otherButtonTitles:nil handler:^(UIAlertView *alertView, NSInteger buttonIndex) { | ||
[MobClick event:EVENT_WALLET_QR_SAVE]; | ||
}]; | ||
} | ||
} | ||
|
||
|
||
#pragma mark - # Event Response | ||
- (void)longPressQRCodeImage:(UILongPressGestureRecognizer *)sender | ||
{ | ||
if (sender.state == UIGestureRecognizerStateBegan) { | ||
TLActionSheet *actionSheet = [[TLActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"保存二维码到相册" otherButtonTitles:nil]; | ||
[actionSheet show]; | ||
} | ||
} | ||
|
||
@end |