-
- 思路:首先要展示的肯定是加载的界面,我们在ViewContrller文件里先把初始界面放上去 UIImageView* imageSelf = [[UIImageView alloc]init];
imageSelf.image = [UIImage imageNamed:@"UIIMG.jpeg"];
imageSelf.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.view addSubview:imageSelf];
selector:@selector(timeOut) 是时间结束之后的事件函数repeats:NO 指 不重复 这里只是简单的使用 不需要重复该行为 // 定时器
NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(timeOut) userInfo:nil repeats:NO];
// 手动添加到Runloop
[[NSRunLoop currentRunLoop]addTimer:myTimer forMode:NSDefaultRunLoopMode];
- (void)timeOut UIWindow * window = [UIApplication sharedApplication].windows[0]; window.rootViewController = tabController;
UIWindow * window = [UIApplication sharedApplication].windows[0];
window.rootViewController = tabController;

NSString* s = @"strId";
UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath];
UITableViewCell* cell= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:s];
if (cell == nil) {
cell= [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:s]; }
// 添加小控件
UISwitch* switchDeep = [[UISwitch alloc] init];
这样自己创建的Cell单元格就会引起复用
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface EightTableViewCell : UITableViewCell
@property (nonatomic, strong) UILabel *FirstLabel;
@property (nonatomic, strong) UILabel *SecondLabel;
@property (nonatomic, strong) UIScrollView *scrollView;
@end
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier: reuseIdentifier];
//添加右侧箭头
self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
self.FirstLabel = [[UILabel alloc] init];
[self.contentView addSubview: _FirstLabel];
self.FirstimageView = [[UIImageView alloc] init];
[self.contentView addSubview: _FirstimageView];
self.Switch = [[UISwitch alloc] init];
[self.contentView addSubview: _Switch];
self.backgroundColor = [UIColor whiteColor];
return self;
}
- (void)layoutSubviews {
_FirstimageView.frame = CGRectMake(15, 10, 35, 35);
_FirstLabel.frame = CGRectMake(70, 0, 200, 60);
_Switch.frame = CGRectMake(320, 20, 100, 60);
}
[self.tableView registerClass:[SevenTableViewCell class] forCellReuseIdentifier:@"seven"];
else if (indexPath.row == 7) {
SevenTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"seven" forIndexPath:indexPath];
cell.FirstLabel.text = @"夜间模式";
cell.FirstimageView.image = [UIImage imageNamed: @"dark.png"];
return cell;
}


