我在我的应用程序上遇到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) 我有以下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