为了与UISegmentedControl进行排序,如何设计UITableView的数据源?

编程入门 行业动态 更新时间:2024-10-16 19:24:55
本文介绍了为了与UISegmentedControl进行排序,如何设计UITableView的数据源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在设计和编码iPhone应用程序以显示电影播放时间.我目前有一个包含以下内容的电影课:

I am in the process of designing and coding an iPhone application to display movie times. I currently have a Movie Class which contains:

  • NSString title
  • NSSDate releaseDate
  • NSSDate score
  • NSString title
  • NSSDate releaseDate
  • NSSDate score

我的UI是一个简单的UINavigationController,它的标题具有分段控件,而UITableView则用于在Interface Builder中显示电影设置.分段控件具有3个分段:标题,开幕日期和得分(在RottenTomatoes上).表格视图的数据当前由NSMutableArray movies提供,这是AppDelegate的属性.

My UI is a simple UINavigationController which has a segmented control as it's title and UITableView to display the Movies setup in Interface Builder. The segmented control has 3 segments: Title, Opening Date, and Score (on RottenTomatoes). The data for the table view is currently provided by a NSMutableArray movies which is a property of the AppDelegate.

我知道我可以使用以下代码注册目标动作,但是目前我不确定如何对UITableView数据进行排序:

I know that I can register target actions using the following code, but I am unsure of how to sort the UITableView data at this point:

[segmentedControl addTarget:self action:@selector(action:) forControlEvents:UIControlEventValueChanged];

每当UISegmentedControl选定的细分发生变化时,如何以及在何处诉诸UITableView?

How and where do I resort the UITableView whenever the UISegmentedControl selected segment changes?

推荐答案

此外,您还可以使用NSArray中的任何sortArrayUsing xxx方法对数据进行排序.

Also, you can sort the data with any of the sortArrayUsingxxx methods in NSArray.

更多推荐

为了与UISegmentedControl进行排序,如何设计UITableView的数据源?

本文发布于:2023-07-09 21:26:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1088252.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据源   UISegmentedControl   UITableView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!