优化松诺在小屏设备上的滑动

This commit is contained in:
xuemh 2018-06-12 09:58:28 +08:00
parent 85cebc7912
commit 9462b3f3bb
1 changed files with 23 additions and 2 deletions

View File

@ -26,9 +26,10 @@
#import "SongNuo86Name.h"
#import "UserExtendataArchaver.h"
@interface SongNuoDBCenterViewController ()
@interface SongNuoDBCenterViewController ()<UITableViewDelegate>
{
dispatch_queue_t _songNuoMainQueue;
CGFloat _tableviewSizeHeight;
}
@property(nonatomic,strong) SongNuoDBSetViewController *songNuoSetVC;
@ -58,8 +59,26 @@
[self.setbackBtn addTarget:self action:@selector(songNuoBDSetBtnAction) forControlEvents:UIControlEventTouchUpInside];
UITapGestureRecognizer*tapgestureRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(songNuoBDSetBtnAction:)];
[self.setImag addGestureRecognizer:tapgestureRecognizer];
[self.tableView addObserver:self forKeyPath:@"contentSize" options:NSKeyValueObservingOptionNew context:nil];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
if ([keyPath isEqualToString:@"contentSize"]) {
NSValue *new = [change valueForKey:NSKeyValueChangeNewKey];
CGSize size = [new CGSizeValue];
if (size.height == 0) {
self.tableView.contentSize = CGSizeMake(size.width, _tableviewSizeHeight);
}
} else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
- (void)dealloc {
[self.tableView removeObserver:self forKeyPath:@"contentSize"];
}
#pragma mark-
-(void)songNuoBDSetBtnAction{
@ -248,8 +267,10 @@
self.nuoJiaReBtn = self.button;
self.jiaReName = textLbl;
}
_tableviewSizeHeight = 64 + CGRectGetMaxY(textLbl.frame);
}
[self initCHNames];
}