Tag: 客观

单击UITableview单元格内的search时出现错误的结果

在tableview的单元格中,我有一个button。 该button基本上打开单元格引用的文件。 这是工作正常,而search不上。 但是,search时,我似乎无法得到search结果数组中的正确的行。 这是我迄今为止所尝试的:在cellForRowAtIndexPath标记button。 myDownloadsBtn = (UIButton *) [cell viewWithTag:106]; 行动设置如下: [myDownloadsBtn addTarget:self action: @selector(downloadClicked:event:) forControlEvents:UIControlEventTouchUpInside]; 然后在downloadClicked我有以下 NSSet *touches = [event allTouches]; UITouch *touch = [touches anyObject]; NSString *todoRow; CGPoint currentTouchPosition = [touch locationInView:self->tableview]; NSIndexPath *indexPath = [self->tableview indexPathForRowAtPoint: currentTouchPosition]; 但是它给了我VISIBLE当前位置的indexPath,而不是search结果数组中行的位置。 此外,我的委托方法的didSelectRowAtIndexPath正常工作,没有search。 这只是单元格内的button。 我发现这个问题,但没有答案: 如何在iOS中search时获得选定的tableviewbutton值 。 其他问题涉及如何知道search时select的实际单元格,但这不是我的问题。 谢谢。

设置SWTableViewCell

我想利用开源的UITableViewCell子类SWTableViewClass但SWTableViewClass问题。 我收到的响应“重新定义一个不同types的单元格* _strong vs UITableView * _strong”这是我的代码: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"FactorCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } SWTableViewCell *cell = (SWTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { NSMutableArray *leftUtilityButtons = [NSMutableArray new]; NSMutableArray *rightUtilityButtons = […]

UIAccessibility – 从上到下阅读屏幕上的所有标签和button

当视图显示只有第一个标签正在读取时,如何让应用程序读取屏幕上的所有标签而不触摸屏幕,以便用户可以知道有哪些选项可用? 谢谢

缺省实现中缺lessUITableViewCell detailTextLabel

这似乎是一个重复的问题,但我已阅读所有主题,我还没有find我的答案,所以我决定发表一个新的问题。 我正在使用UITableViewCellStyleSubtitle默认实现,但detailTextLabel不会出现,除非我每次创build一个新的单元格。 这是代码 – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. [tblvUsersList registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; } – (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return (self.registeredUser && […]

TableView不能重新加载

我正在devise一个使用表格视图的一对一聊天界面。 这个表视图被修改,以显示一些新的消息到达泡沫。 在这种情况下,新消息通过推送通知到达。 我在通过推送通知接收消息的函数中调用以下代码: -(void)messageReceived: (NSString *)message{ _message=[message retain]; [tableView reloadData]; } 但是,似乎这不会重新加载我的表格视图。 如果我把调用reloadData放在viewDidAppear函数中,它可以重新加载。 如果我将reloadData调用放在一个返回types为IBAction的函数中(例如:一个绑定到button单击的函数),它也会重新加载, 可能是reloadData不能通过自定义声明的函数触发的原因?

UICollectionView不滚动到位置

我有一个静态的UITableView UICollectionView 。 我正在尝试使collectionView滚动到viewDidLoad的indexPath 。 它不会滚动到启动位置,当我select一个indexPath它滚动到该位置。 我做了一个清洁的项目,产生了这个问题。 我认为最简单的方法就是不要让你尝试重现问题,而只是上传它。 所以这里是: 有问题的项目

如何正确定位右侧的UITableView单元格子视图?

所以我试图添加一个UISwitch到我右边的表格单元格中。 我第一次尝试将它添加到accesoryView ,但是当我在表中进入编辑模式时,UISwitch消失。 所以现在我把它添加到contentView ,它工作的很好,没有消失。 但它将其添加到左上angular。 所以我试图把它添加到右边,但我想远离绝对值,以支持所有大小和方向。 所以我试着用这个代码: [[cell contentView] addSubview:switchView]; switchView.frame = CGRectMake(cell.contentView.frame.size.width – switchView.frame.size.width, 0, switchView.frame.size.width, switchView.frame.size.height); 但是,这是我得到: 任何想法如何解决这个问题?

UITableviewCell返回为零内块

我的tableView:cellForRowAtIndexPath:实现如下: – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { BSProductCell *cell = [tableView dequeueReusableCellWithIdentifier:BSProductCellIdentifier]; cell.productImageView.image = [UIImage imageNamed:@"Placeholder"]; [[BSImageLoader sharedInstance] getImageWithURL:self.dataSourceArray[indexPath.row] withCompletionBlock:^(UIImage *image, BOOL fromCache, NSString *error){ BSProductCell *tableCell = (BSProductCell *)[self.tableView cellForRowAtIndexPath:indexPath]; [tableCell.productImageView setImage:image]; NSLog(@"%@", tableCell); }]; return cell; } getImageWithURL:withCompletionBlock:如果在本地caching中找不到它,或者只是从caching中返回,则从指定的URL下载图像。 起初,当视图加载和单元格填充时,所有事情都按预期进行:图像正在下载,然后放置在单元格内。 问题是当我开始滚动tableview,NSLog显示(null) 。 我只是不知道为什么tableCell对象为null。 PS:我遵循一个与苹果几乎完全相同的例子,写了我的例子。 另外我检查, self.tableView和indexPath是零内块。

文本becomeFirstResponder抛出EXC_BAD_ACCESS代码= 1地址= 0x1

这是一个问答,希望能帮助遇到这个问题的其他人。 这个问题似乎随机发生,而我正在传输控件之间的FirstResponder链。 这些控件是从UIViewinheritance的自定义控件对象, UITextField或UITextView作为子视图添加(使用其他控件),并完全在代码中生成。 不是生成的控件的每个实例都抛出exception,但是不pipe是textfield/textview在代码中调用了[text becomeFirstResponder] ,还是使用了textfield/textview 。 我在这个头发上撕了6个小时

Leptonica申请门槛

我正在尝试使用leptonica的pixOtsuAdaptiveThreshold函数,但运气不大。 我不知道如果我做的是正确的,但我想采取UIImage(objective-C),应用pixOtsuAdaptiveThreshold,然后转换回UIImage。 当我用传入的参数调用pixOtsuAdaptiveThreshold时,它崩溃了。 谁能告诉我我做错了什么? 我一直在为此挣扎2天,我想我正在失去理智。 谢谢! 码 -(void)leptnoica:(UIImage *)image { CGImageRef myCGImage = image.CGImage; CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(myCGImage)); const UInt8 *imageData = CFDataGetBytePtr(data); PIX *myPix = (PIX *) malloc(sizeof(PIX)); myPix->w = (int)CGImageGetWidth (myCGImage); myPix->h = (int)CGImageGetHeight (myCGImage); myPix->d = (int)CGImageGetBitsPerComponent(myCGImage); myPix->wpl = (CGImageGetBytesPerRow (myCGImage)/4); // myPix->informat = IFF_TIFF; myPix->informat= IFF_PNG; myPix->data = (l_uint32 *) imageData; […]