延迟设置
[self performSelector:@selector(createButton) withObject:nil afterDelay:1];
tableview 悬浮按钮
#import "TabVc.h"
@interface TabVc ()
{
UIView *_aview;
}
@end
@implementation TabVc
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.backgroundColor = [UIColor whiteColor];
_aview = [[UIView alloc]initWithFrame:CGRectMake(100, 300, 50, 50)];
_aview.layer.cornerRadius = 25;
_aview.layer.masksToBounds = YES;
_aview.backgroundColor = [UIColor redColor];
[self.tableView addSubview:_aview];
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
_aview.frame = CGRectMake(100, 300+scrollView.contentOffset.y, 50, 50);
}