我在我的应用程序中使用日期选择器我希望当我从日期选择器中选择日期并单击完成按钮我需要列出所有其他类中的所有东西在某些视图中发生在特定日期我选择了。哪种视图最适合我展示这些事情?iphone中的日期选择器
回答
正如你所说,你已经创建了datePicker,所以当你点击完成按钮。
1)将相应的数据存储到数组中,以便您可以将该数据显示在UItableView
上。
2)创建TableView:在这里你只需要创建TableView并显示这些数据。假设已经收集了你的Array中的数据(如步骤1)。
按照给定的步骤在tableView中创建数据。
A)在UiViewController
创建的UItableView
实例中,你要显示的TableView .H类
AS `UITableView *myTableView`;
B)采用的UITableViewDataSource,在视图控制器的UITableViewDelegate协议,其中你要带的TableView C)创建表(以编程方式或通过IB(界面生成器) 这里我以编程方式显示
//you may call this Method View Loading Time.
-(void)createTable{
CGrect yourFrame=CGrectMake(0,20,320,400);//Set Desired Frame of Table;
myTableView=[[[UITableView alloc]initWithFrame:yourFrame style:UITableViewStylePlain] autorelease];
myTableView.backgroundColor=[UIColor clearColor];
myTableView.delegate=self;
myTableView.dataSource=self;
myTableView.separatorStyle= UITableViewCellSeparatorStyleNone;
myTableView.scrollEnabled=YES;
[self.view addSubview:myTableView];
}
//Data Source method to create number of section in Table View
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Data Source method to create number of rows section of a Table View
- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
return [yourMutableArray count];
}
// Data Source method to create cells in Table View
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
//here you check for PreCreated cell.
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
//Fill the cells...
cell.textLabel.text = [yourMutableArray objectAtIndex: indexPath.row];
//yourMutableArray Contains the Data(When You click On Done Button this array will stored the data).
return cell;
}
我希望它会真的帮助你。
我认为UItableView
将是不错的选择。
我该怎么做? – 2012-03-01 12:26:33
看看:http://www.mobisoftinfotech.com/blog/iphone/introduction-to-table-view/ – Apurv 2012-03-01 12:28:16
我认为它更好地使用泰伯维只因为改变u必须改变数据也是此日期之后,因此,如果u使用表格视图,我们只要简单的重启的tableview这将是简单
yah.thnx克里希纳 – 2012-03-01 14:19:19
一旦你点击完成按钮,查询获取所有数据的基础上选定的数据,并将其存储在一些阵列...并重新加载表视图与数组中的数据...
- 1. 如何在iphone中验证日期选择器中的日期?
- 2. 在jQuery日期选择器中选择日期和高亮日期选择器
- 3. 无法从日期选择器中的日期选择器中获取日期
- 4. 根据日期选择器中选择的日期禁用日期选择器的以前的日期
- 5. 选择js中日期选择器的可选日期
- 6. 日期时间选择器在iPhone
- 7. 修改日期选择器在iPhone SDK
- 8. 更改日期选择器样式iphone
- 9. 道场日期选择器jQuery的Vs的日期选择器
- 10. 更改jQuery日期选择器中的日期选择其他
- 11. 获取在日期选择器中选择的所有日期
- 12. 设置在日期选择器中选择的最短日期
- 13. 如何增加从日期选择器中选择的日期?
- 14. Python&Selenium无法在日期选择器中选择日期
- 15. 使用Selenium在日期选择器中自动选择日期
- 16. jQuery的日期选择器选择
- 17. 与日期选择器的RadioButton选择
- 18. Jquery的日期选择器不选择默认的日期
- 19. Grails的日期选择器
- 20. jQuery的日期选择器
- 21. 日期选择器,jQuery的
- 22. 的Javascript日期选择器
- 23. jQuery的日期选择器 -
- 24. JavaScript的日期选择器
- 25. 日期选择器IE8的
- 26. 如何在iphone中设置NSTimeZone日期选择器控制器
- 27. 选择相同的日期作为日期选择器
- 28. jQuery日期选择器,选择范围内的特定日期
- 29. 没有选择缺省日期的日期选择器
- 30. Chrome浏览器中的日期范围选择器日期选择问题
它确实帮助我thanx很多 – 2012-03-01 14:18:29