Tag: tableview

从Parse中sorting结果不像按预期的那样使用query.limit

我为我的查询设置了一个限制,例如10,然后我想获得数据集中的最后10个结果,并按升序sorting! 好的,我知道我可以补充: [messages addDescendingOrder:@"createdAt"]; //OR [messages addAscendingOrder:@"createdAt"]; 但是这样做是因为它得到的前10条logging或最后10条logging…它不是自己sorting的结果! 升序基本上是设置结果将要开始的地方…从底部或顶部。 但是我想要将结果集返回为最后的10个结果,并且结果按升序排列。 相反,我得到的最后10个结果,但在表中,我有最新的一个在顶部和最老的一个是在表中的最后一个单元格…我想要的相反… 有没有办法让Parse处理这个问题而不是在设备本身上做逻辑? 任何帮助是极大的赞赏。

从Xamarin.iOS中的TableView Cell以编程方式推入一个segue

我正在用Xamarin开发一个相当简单的应用程序,但是我陷入了一件事:我在UIViewController中创build了一个tableView。 单元格渲染是在外部类中完成的:TableSource.cs。 UITableViewSource的一个子类。 处理行单击我重写行select: public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { new UIAlertView("Row Selected", tableItems[indexPath.Row], null, "OK", null).Show(); tableView.DeselectRow (indexPath, true); // iOS convention is to remove the highlight //Push another ViewController on top: UINavigationController test = new UINavigationController (); test.PushViewController (new UIViewController (),true); } 像迄今为止的魅力。 但是当我尝试推顶另一个ViewController,显示关于该行的详细数据,只是没有任何反应,我没有得到任何错误或exception消息。 我也用导航的自定义类来尝试它。 控制器和视图控制器,它不会改变任何东西。

通过点击一个button添加一个tableViewCell到一个新的TableView

我想,如果用户点击一个button,这些tableCell应该被添加到一个新的tableView(你可以看到你的collections夹)。 我有一个类的Car , Car的内容是合成的: #import "Car.h" @implementation Car @synthesize name; @synthesize speed; @synthesize selected; @end CarsViewController包含一个tableView,你可以find每辆车: @implementation CarsViewController { NSArray *cars; } @synthesize tableView = _tableView; – (void)viewDidLoad { Car *car1 = [Car new]; car1.name = @"A1"; car1.speed = @"200 km/h"; car1.selected = FALSE; Car *car2 = [Car new]; car2.name = @"A2"; car2.speed = @"220 […]

在tableview中创build行时出错

在tableview中创build行时出错。 我的表视图加载了一个JSON。 我在这里看到很多例子,但是没有一个能够解决 我的代码 NSMutableArray *myArray = [NSMutableArray arrayWithArray:news]; [myArray insertObject:@"teste" atIndex:0]; NSMutableArray *path = [NSMutableArray arrayWithObject:[NSIndexPath indexPathForRow:[news count]-1 inSection:1]]; [self.tableView insertRowsAtIndexPaths:path withRowAnimation:UITableViewRowAnimationAutomatic]; [self.tableView endUpdates]; 显示错误 2013-05-30 23:15:17.345 lerJson [1141:c07] *声明失败 – [UITableView _endCellAnimationsWithContext:],/ SourceCache /UIKit_Sim/UIKit-2380.17/UITableView.m:908 2013-05-30 23:15: 17.347 lerJson [1141:c07]终止应用程序,由于未捕获的exception'NSInternalInconsistencyException',原因:'尝试插入第11行到第1节,但更新后只有1节* *第一次抛出调用堆栈:(0x1c95012 0x10d2e7e 0x1c94e78 0xb68665 0xb670b 0xc4945 0xc4973 0x476d 0x76d78 0x789eb 0x2e185a 0x2e099b 0x2e20df 0x2e4d2d […]

Tableview简单的显示值

我是一个swift3的stduent和非常初学者。 在这里,我只想在tableview中显示“First”,“Second”,“Third”,看起来不太好。 来自YouTube的教程是swift2,我试图转换成swift3。 我认为这个问题与代码有关: let Cell = self.tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as UITableViewCell 我努力search像https://www.codeschool.com/blog/2016/09/14/evolving-to-swift-3/,但我不知道发生了什么。 Xcode无法检测到代码的任何错误,它可以运行。 在iPhone模拟器的桌面视图是空的或整个屏幕是黑色的。 我使用导航控制器来实现它。 表视图单元格中viewcontoller和iderntifer中的类在根视图控制器中设置良好。 请帮帮我。 谢谢。 import Foundation import UIKit class ViewController: UITableViewController { var Array = [String]() override func viewDidLoad() { super.viewDidLoad() Array = ["First","Second","Third"] } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return Array.count } […]

从FavoriteTableView发送数据到DetailView?

我有我的app.when用户触摸单元格中的tableview,detailview和favoriteview将去详细信息包含照片,标签,文本字段和button添加到favorite.user可以触摸最喜欢的button,以添加特定的单元格为favoritetableview。 我可以successfullly添加细胞favoritetableview,但是当我触摸cellit in favoritetableview并去详细视图,没有任何加载detailtableview(照片和文本框等)只能发送名称detailView如何发送照片和textfield等detailview favoriteview? 我怎样才能达到从bestview同维护视图的detailview? 任何想法,将不胜感激。 谢谢。 这是我的模特照片:[enter image description here] [1] 这是每个观点的准备方法: maintableview: – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"SpeciesDetail"]) { GeneralViewController *detailViewController = (GeneralViewController*)[segue destinationViewController]; NSIndexPath *path = [self.tableView indexPathForSelectedRow]; BirdInfo *info; BirdImage *imageObj; if (!_didSearch) { info = (BirdInfo *)[self.fetchedResultsController objectAtIndexPath:path]; imageObj = info.thumbnailImage; } else { info =(BirdInfo […]

一些dynamic高度的tableview单元格,其他高度固定的单元格

我有一个tableview。 我想要一些具有dynamic高度的tableview单元格,而其他单元格的高度是固定的。 对于dynamic高度,我在viewDidLoad视图控制器委托中使用了以下几行代码。 tableView.estimatedRowHeight = 200 tableView.rowHeight = UITableViewAutomaticDimension 在一个tableview中有固定加权单元格和自定义单元格的有效方法是什么? 提前致谢。

为什么tablePath的第一部分的indexPath是以

我有一个tableView,它分为2个部分。 func numberOfSections(in tableView: UITableView) -> Int { return 2 } 每个部分都有它自己的FetchResultController(FRC)。 这是我的CellForRoatAt函数 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "personCell", for: indexPath) as! PersonTableViewCell switch(indexPath.section) { case 0: print("this is section 0") let person = positiveFetchedResultsController.object(at: indexPath) cell.personName.text = person.name //print("\(person.name!) is the name") //print("\(person.statement!.count) postive person […]

在Storyboard中具有不同单元大小和单元格内容的UITableViewController

我想要使​​用不同的单元格大小和不同的单元格内容的UITableViewController 。 例如: 有AutoLayout在Storyboard使用AutoLayout的方式来定义TableViewCells的不同大小? 定义TableViewCells的内容(包含内容的UIView )的最好方法是什么?

阻止表视图在insertRows之后滚动顶部

里面有tableView的viewController。 这个tableView有很多部分和行。 当我尝试使用TableView.insertRows(在:[IndexPath(row:r,section:sec)],在:最后一节添加一个新行:.bottom) tableView滚动到顶部,并显示当前部分中的第一个单元格。 如何防止tableView滚动到顶部? 谢谢 这是我的解决scheme 当尝试添加单元格时,我使用此代码 self.didAddNewCell = true self.chatTableView.reloadData() self.scrollToBottom() 然后添加这个代码 func scrollViewDidScroll(_ scrollView: UIScrollView) { if self.didAddNewCell { self.didAddNewCell = false let bottomOffset = CGPoint(x: CGFloat(0), y:CGFloat(chatTableView.contentSize.height – self.chatTableView.bounds.size.height)) scrollView.setContentOffset(bottomOffset, animated: true) } } 而这个代码滚动到底部 func scrollToBottom() { let sections = self.chatTableView.numberOfSections if sections > 0 { let rows = self.chatTableView.numberOfRows(inSection: […]