Tag: 客观

UITableView设置背景颜色

我改变tableView:cellForRowAtIndexPath方法中的UITableViewCells的背景颜色 if(indexPath.row % 2 == 0){ cell.backgroundColor = … } else{ cell.backgroundColor = … } 但是,这只会改变tableView:numberOfRowsInSection中指定的单元格的颜色(如附图所示,前四个之后有白色单元格) 是否可以更改屏幕上显示的所有单元格的颜色?

UITableView设置隐藏的tableview行

我在grouptableview中有一个自定义tableview单元格。 我有一个隐藏的。 然后我必须使其可见。 单元格标签是3。 这不是我的代码工作: if (self.tableView.tag == 3) { self.tableView.hidden = NO; //Not working. } 只是我需要使一行是可见的。 我希望你明白。

UICollectionVIew:在滚动时为单元格添加animation

我想我的UICollectionView项目在用户滚动浏览列表(我正在使用UICollectionViewFlowLayout的子类)中UICollectionViewFlowLayout 。 我在布局pipe理器中指定位置,我希望能够做的是也指定一个初始变换,并在正确的时间(当单元格第一次出现在屏幕上)在animation中应用。 要查看我的意思,请查看iOS上的Google Plus应用程序。 理想情况下,取决于细胞位置的不同变换。 我似乎无法find一种方法来找出何时显示一个单元格(没有等同于在UITableView的willDisplayCell )或任何指针去哪里去。 有什么build议么? 在这个屏幕截图中,您可以制作Google Plus中的animation: 另外,看看iPad上的iPhoto。 我不知道他们是否使用UIcollectionView(可能不是,因为它在iOS5上工作),但这是sorting,如果我正在寻找效果,照片似乎从右侧飞入。

alignmentUITableView中的文本

我有一个单元格。 只要单元格行中的文本等于“(null)”,我希望标签位于单元格的右侧。 这是我目前的代码,但它没有做任何事情。 没有错误,它只是不alignment到单元格的右侧。 有任何想法吗? – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *CellIdentifier = @"ChatListItem"; NSDictionary *itemAtIndex = (NSDictionary *)[messages objectAtIndex:indexPath.row]; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if([[itemAtIndex objectForKey:@"user"] isEqualToString:@"(null)"]){ cell.textLabel.textAlignment=UITextAlignmentRight; cell.detailTextLabel.textAlignment=UITextAlignmentRight; } cell.textLabel.text = [itemAtIndex objectForKey:@"text"]; cell.detailTextLabel.text = [itemAtIndex objectForKey:@"user"]; return cell; […]

iOS CustomTableViewCell:元素不能正确alignment

我在构build应用程序时第一次学习iOS 。 在其中一个要求中, UITableViewCell需要看起来像 (PS:这只是一个devise,没有代码是为此写的) 但是,当我devise我的UITableViewCell ,它看起来像 和生成这个代码看起来像 – (void)setTransactionCell:(TransactionCell *)transactionCell transactionModel:(TransactionModel *)transactionModel { transactionCell.dateOfMonth.image = [self getDayImage:[UIImage imageNamed:@"1"]]; transactionCell.dayOfWeek.image = [self getDayImage:[UIImage imageNamed:@"Sun"]]; transactionCell.name.text = transactionModel.name; transactionCell.name.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:15]; transactionCell.amount.text = transactionModel.amount; transactionCell.amount.font = [UIFont fontWithName:@"HelveticaNeue-Light" size:15]; transactionCell.categoryImage.image = [self getCategoryImage:[UIImage imageNamed:transactionModel.category]]; transactionCell.imageView.contentMode = UIViewContentModeCenter; } – (UIImage *)getDayImage: (UIImage *) image […]

保存希伯来语文本NSUserDefaults返回奇怪的编码

我将希伯来文保存到NAMutableArray,然后将其保存到NSUserDefalts,如下所示: numOfWallPosts++; NSString *tempKeyToStore = [NSString stringWithFormat:@"wall_post_%d", numOfWallPosts]; // wall_post_%d NSMutableArray *tempArray = [[NSMutableArray alloc] init]; [tempArray addObject:currentOwner]; [tempArray addObject:currentTitle]; [tempArray addObject:currentText]; [tempArray addObject:currentDate]; [tempArray addObject:currentTime]; [tempArray addObject:currentImageURL]; [tempArray addObject:currentWallID]; [self.sharedPrefs setObject:tempArray forKey:tempKeyToStore]; [self.sharedPrefs synchronize]; 当我想要得到希伯来语的文本,我得到这样的文字: Wall messages: ( "\U05de\U05e2\U05e8\U05db\U05ea", "\U05ea\U05e8\U05d2\U05d9\U05dc \U05e4\U05d9\U05e7\U05d5\U05d3 \U05d4\U05e2\U05d5\U05e8\U05e3", "\U05d0\U05d6\U05e2\U05e7\U05ea \U05ea\U05e8\U05d2\U05d5\U05dc \U05d1\U05e9\U05e2\U05d4 19:05", "27/05/13", "13:16", "http://blabla……", 9 ) 我试图用NSUTF8StringEncoding格式化文本,用NSUTF8StringEncoding格式化文本,我仍然用这种方法得到文本。 我可以用正确的方式保存文本还是将其编码回适当的希伯来文? 编辑:这是如此奇怪,虽然文字保存奇怪,我把它拉回来,我得到正确的文字。 […]

通过单击自定义UIButton删除UITableView行

基本上我想删除行上的一个button,这是该行的一部分单击事件。 我不能使用提交编辑风格,因为我想执行取消订阅和删除相同的button。 点击订阅button,我想删除特定的行。 所以任何想法,我怎么能做到这一点。

Z UITableViewCell中图像和分隔符的索引

我有一个UITableViewCell有一个图像,部分坐落在单元格之外。 见附件。 但是,分隔线覆盖图像。 有没有办法摆脱这个分隔线? 我发现最好的是closures所有tableviewcell分隔符,但我不想这样做,因为它与UI混乱。 我希望能够调整UIImageView z-index或tableviewcell分隔符z-index。 我试过[self bringSubviewToFront:self.overflowImageView]; 在UITableViewCell上,但不会改变任何东西。 即使我可以将分隔符的宽度更改为1px,我也可以,但似乎无法更改tableview顶部和底部的分隔符。 任何人都有想法如何让图像上方的图像?

对于viewForHeaderInSection中的自定义单元格,重新加载特定的viewForHeaderInSection IOS

我想重新加载viewForHeaderInSection的情况下在viewForHeaderInSection自定义单元重新加载特定的viewForHeaderInSection IOS。 我使用了下面的代码 [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:section] withRowAnimation: UITableViewRowAnimationAutomatic]; 但整个部分将重新加载 我也尝试以下通过创build自定义视图 SearchHeaderView是自定义视图 – (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ lblPrice_Header.text = [NSString stringWithFormat:@"%d",cartSum] ; return SearchHeaderView; } -(void)cartSum :(id)sender{ ….. ……. ======================================= cartSum =cartSum+[[subArray objectAtIndex:j] intValue]*price; UIView *headerVw = [self.tableView headerViewForSection:section]; [headerVw setNeedsDisplay]; [headerVw setNeedsLayout]; } 但它不会重新加载部分。 我有我的部分标题如下 我检查了以下链接 重新加载ios7中的tableView标头 更改UITableView的部分页眉/页脚标题,而无需重新加载整个表格视图

无法接收remoteControlReceivedWithEvent – 目标c – ios

屏幕locking后,我成功启用了我的应用程序,以便能够在后台播放audio和video。 但是,为了更好的用户体验,我想在locking的屏幕上显示播放和暂停正在运行的媒体的控件。 在线跟随几个博客之后,添加了以下代码: @interface MyControllerClass () <UIGestureRecognizerDelegate, UIApplicationDelegate> – (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; [self becomeFirstResponder]; AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:avAsset]; AVAudioSession *session = [AVAudioSession sharedInstance]; [session setCategory:AVAudioSessionCategoryPlayback error:nil]; NSError *activationError = nil; BOOL success = [[AVAudioSession sharedInstance] setActive: YES error: &activationError]; } – (void)viewWillDisappear:(BOOL)animated { [[UIApplication […]