大佬教程收集整理的这篇文章主要介绍了IOS UITableViewCells在第一个小区,Iphone5S设备中都混乱,64位模拟器,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
编辑:第三个图像是64位模拟器,更新的cellForRowATindexPath是超简化的,只需将textLabel设置为所有8行的“Hello”.
Autolayout未在应用程序的任何位置使用.
Iphone 5S正在运行IOS7.1.1,但Iphone5正在运行IOS7.1.模拟器是最新Xcode(5.1.1)的一部分,最新的7.1.我无法想象5s的最新.1可能会导致这种情况.
有什么想法为什么这是混乱的,具体为什么只有在5S?
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 8; } - (float)tableView:(UITableView*)tableView heightForRowATindexPath:(NSIndexPath*)indexPath { float height = self.view.frame.size.height / [self tableView:tableView numberOfRowsInSection:indexPath.section]; return height; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowATindexPath:(NSIndexPath *)indexPath { NSString *CellIdentifier = @"CellMain"; UITableViewCell *_cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (_cell == nil) { _cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reusEIDentifier:CellIdentifier]; _cell.SELEctionStyle = UITableViewCellSELEctionStyleNone; } NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; NSString *user_fullname = [userDefaults valueForKey:@"user_fullname"]; _cell.textLabel.textColor = [UIColor colorWithHexString:@"58A5D5"]; _cell.detailTextLabel.textColor = [UIColor colorWithHexString:@"58A5D5"]; if(indexPath.row == 0){ _cell.textLabel.text = [NSString StringWithFormat:@"%@",@"User Name"];//user_fullname]; _cell.detailTextLabel.text = [NSString StringWithFormat:@"Member since: %@",@"April 28,2014"]; _cell.imageView.image = [UIImage imagenamed:@"profile_photo.png"]; _cell.imageView.contentMode = UIViewContentModeScaleAspectFit; UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imagenamed:@"arrow_right.png"]]; arrowImg.frame = CGRectMake(292,14,18,30); [_cell.contentView addSubview:arrowImg]; } else if(indexPath.row == 1){ _cell.textLabel.text = [NSString StringWithFormat:@"ActivitySync"]; _cell.detailTextLabel.text = [NSString StringWithFormat:@"Last sync: %@",@"5 minutes ago"]; _cell.imageView.image = [UIImage imagenamed:@"iphone_sm.png"]; _cell.imageView.contentMode = UIViewContentModeScaleAspectFit; } else if(indexPath.row == 2){ _cell.contentView.BACkgroundColor = [UIColor colorWithHexString:@"D9DBDB"]; } else if(indexPath.row == 3){ _cell.textLabel.text = [NSString StringWithFormat:@"%@",@"ChALLENges"]; UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imagenamed:@"arrow_right.png"]]; arrowImg.frame = CGRectMake(292,30); [_cell.contentView addSubview:arrowImg]; } else if(indexPath.row == 4){ _cell.textLabel.text = [NSString StringWithFormat:@"%@",@"Setup a New Device"]; UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imagenamed:@"arrow_right.png"]]; arrowImg.frame = CGRectMake(292,30); [_cell.contentView addSubview:arrowImg]; } else if(indexPath.row == 5){ _cell.textLabel.text = [NSString StringWithFormat:@"%@",@"Help"]; UIImageView *arrowImg = [[UIImageView alloc] initWithImage:[UIImage imagenamed:@"arrow_right.png"]]; arrowImg.frame = CGRectMake(292,30); [_cell.contentView addSubview:arrowImg]; } else if(indexPath.row == 6){ _cell.contentView.BACkgroundColor = [UIColor colorWithHexString:@"D9DBDB"]; } else if(indexPath.row == 7){ UIButton *logout = [[UIButton alloc] initWithFrame:CGRectMake(10,9,300,39)]; [logout settitle:@"Log Out of App" forState:UIControlStateNormal]; logout.titleLabel.textColor = [UIColor colorWithHexString:@"58A5D5"]; [logout addTarget:self action:@SELEctor(logoutBtnClicked:) forControlEvents:UIControlEventTouchUpInside]; [_cell.contentView addSubview:logout]; } return _cell; }
以上是大佬教程为你收集整理的IOS UITableViewCells在第一个小区,Iphone5S设备中都混乱,64位模拟器全部内容,希望文章能够帮你解决IOS UITableViewCells在第一个小区,Iphone5S设备中都混乱,64位模拟器所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。