小编use*_*643的帖子

UIAlertController显示延迟

我在我的应用程序上遇到UIAlertController的问题,现在已经迁移到带有日期选择器的iOS8.

下面是代码.

UIAlertController *AlertView = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];

 UIAlertAction *ok = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
{
[AlertView dismissViewControllerAnimated:YES completion:nil];
}];

 UIAlertAction *set = [UIAlertAction actionWithTitle:NSLocalizedString(@"Set to today", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
{
[self set_to_today:nil];
[AlertView dismissViewControllerAnimated:YES completion:nil];
[self.tableView reloadData];
}];

 UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action)
{
[AlertView dismissViewControllerAnimated:YES completion:nil];
}];


 UIDatePicker *datePicker = [[[UIDatePicker alloc] init] autorelease];
 datePicker.datePickerMode = UIDatePickerModeDate;
[datePicker setDate:data_appo];
[datePicker addTarget:self action:@selector(datePickerValueChanged:) forControlEvents:UIControlEventValueChanged];

[AlertView.view addSubview:datePicker];
[AlertView addAction:ok];
[AlertView addAction:set];
[AlertView addAction:cancel];
[self.view …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c uialertview swift uialertcontroller

39
推荐指数
2
解决办法
7989
查看次数

UISearchBar + didSelectRowAtIndexPath + cellForRowAtIndexPath

我有以下UITableViewController+ UISearchBar设置

@interface FeedTableView : UITableViewController <UISearchBarDelegate,UISearchDisplayDelegate>
{
    NSMutableArray *ArrayDatiOriginali;
    NSMutableArray *searchData;

    UISearchBar *searchBar;
    UISearchDisplayController *searchDisplayController;    
}
Run Code Online (Sandbox Code Playgroud)

在加载方法下面

- (void)viewDidLoad
{
    [super viewDidLoad];

    searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];

    searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self];
    searchDisplayController.delegate = self;
    searchDisplayController.searchResultsDataSource = self;
    searchDisplayController.searchResultsDelegate=self;

    self.tableView.tableHeaderView = searchBar;  tableView.
}
Run Code Online (Sandbox Code Playgroud)

当我使用UISeach时选择数据/行

if(tableView==self.searchDisplayController.searchResultsTableView)
{
    NSLog(@"Riga corrente: %i",indexPath.row);
    appo=[searchData objectAtIndex:indexPath.row];
}
Run Code Online (Sandbox Code Playgroud)

它适用于过滤表视图.

但如果:

  • 搜索视图处于活动状态(显示过滤结果)
  • 我点击过滤结果的一行

然后

  • didSelectRowAtIndexPath 被解雇但是
  • cellForRowAtIndexPath方法中表达

    if(tableView == self.searchDisplayController.searchResultsTableView)返回FALSE

如果UISearchView是活跃的

有任何想法吗?

iphone objective-c uitableview uisearchbar uisearchdisplaycontroller

2
推荐指数
1
解决办法
1786
查看次数