编辑:第三个图像是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;}解决方法 返回CGfloat,而不是从heightForRow方法浮动.这是一个64位问题 – 类型在那里定义不同.我认为返回一个浮点值会导致64位设备中的高度被视为零.
您需要更改方法的返回类型以及其中的声明.不要使用浮动UIKit的东西,它总是CGfloat.
总结以上是内存溢出为你收集整理的IOS UITableViewCells在第一个小区,Iphone5S设备中都混乱,64位模拟器全部内容,希望文章能够帮你解决IOS UITableViewCells在第一个小区,Iphone5S设备中都混乱,64位模拟器所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)