Tag: uitableview

使用不适用于UITableView seperatorColor?

我正在尝试configuration深灰色分隔符颜色。 为什么下面什么都不做? self.tableView.seperatorStyle = UITableViewCellSeperatorStyleSingleLine; self.tableView.seperatorColor = [UIColor colorWithRed: 127 green:127 blue:127 alpha:1]; 返回一个没有分离器的表格。 只要我使用[UIColor blackColor],那么我得到分离器就好了。 这是怎么回事?

UITableView清除背景

我意识到,iOS 7还没有正式发布,我们不应该讨论,但我疯了试图找出这个问题。 在iOS 6上,我的表格视图是透明的,看起来不错。 第一次运行iOS 7,背景是白色的。 我已经尝试使桌面backgroundColor,单元格颜色等等,以UIColor clearColor但没有改变。 如何解决这个问题?

获取button按下UITableView单元格的行

我有一个表格控制器显示一行单元格。 每个单元格有3个button。 我已经为每个单元格的标签编号为1,2,3。 问题是我不知道如何find一个button被按下的单元格。 我目前只有一个button被按下时才能获得发件人的标签。 有没有办法获得单元格行号以及按下button时?

iPhone:用导航栏显示模态UITableViewController

我展示了一个UITableViewController类的模态视图。 出于某种原因,它不会显示导航栏。 这是我的代码: SettingsCreateAccount *detailViewController = [[SettingsCreateAccount alloc] initWithStyle:UITableViewStyleGrouped]; detailViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; detailViewController.navigationController.navigationBarHidden = NO; [self.navigationController presentModalViewController:detailViewController animated:YES]; detailViewController = nil; [detailViewController release]; 我以为这是默认显示? 如果有帮助,我从另一个类也调用这个UITableViewController UINavigationControllerpipe理。 想法?

Swift,添加滑动删除UITableViewCell

我正在学习iOS的Swift,我正在用UITableView制作一个CheckList应用程序。 我想知道如何添加滑动删除UITableViewCell 。 这是我的ViewController.swift: import UIKit class ViewController: UIViewController, UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource { var tableView: UITableView! var textField: UITextField! var tableViewData:Array<String> = [] // Define Colors let lightColor: UIColor = UIColor(red: 0.996, green: 0.467, blue: 0.224, alpha: 1) let medColor: UIColor = UIColor(red: 0.973, green: 0.388, blue: 0.173, alpha: 1) let darkColor: UIColor = UIColor(red: […]

滚动UITableView时隐藏键盘

在我的应用程序,我想隐藏键盘,当我开始滚动UITableView。 我在网上search这个,大多数答案是UITableView的子类(http://stackoverflow.com/questions/3499810/tapping-a-uiscrollview-to-hide-the-keyboard)。 我做了子类,但它不工作。 #import <UIKit/UIKit.h> @protocol MyUITableViewDelegate <NSObject> @optional – (void)myUITableViewTouchesBegan; @end @interface MyUITableView : UITableView <UITableViewDelegate, UIScrollViewDelegate> { id<MyUITableViewDelegate> delegate; } @end .m文件 #import "MyUITableView.h" @implementation MyUITableView – (void)scrollViewDidScroll:(UIScrollView *)scrollView{ NSLog(@"delegate scrollView"); //this is dont'work [super scrollViewDidScroll:scrollView]; } – (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"delegate myUITableViewTouchesBegan"); // work only here [delegate myUITableViewTouchesBegan]; [super touchesBegan:touches […]

UIRefreshControl – 当UITableViewController位于UINavigationController中时,beginRefreshing不工作

我已经在我的UITableViewController(这是一个UINavigationController内)设置一个UIRefreshControl和它按预期的方式工作(即拉下来触发正确的事件)。 但是,如果我以编程方式调用刷新控件上的beginRefreshing实例方法,如: [self.refreshControl beginRefreshing]; 什么都没发生。 它应该animation下来,并显示微调。 刷新后调用endRefreshing方法时可以正常工作。 我用这种行为掀起了一个基本的原型项目,它正常工作时,我的UITableViewController直接添加到应用程序委托的根视图控制器,例如: self.viewController = tableViewController; self.window.rootViewController = self.viewController; 但是,如果我首先添加tableViewController到一个UINavigationController,然后添加导航控制器作为rootViewController , beginRefreshing方法不再起作用。 例如 UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:tableViewController]; self.viewController = navController; self.window.rootViewController = self.viewController; 我的感觉是,这与导航控制器中的嵌套视图层次结构有关,不能很好地进行复习控制 – 任何build议? 谢谢

如何以编程方式设置UITableView节标题(iPhone / iPad)?

我已经使用storyboards在Interface Builder中创build了一个UITableView 。 UITableView设置了static cells和许多不同的部分。 我遇到的问题是我试图用几种不同的语言设置我的应用程序。 为此,我需要能够以某种方式更改UITableView节标题。 请有人可以帮我吗? 理想情况下,我想用IBOutlets来解决这个问题,但是我怀疑在这种情况下这是不可能的。 任何意见和build议将非常感激。 提前致谢。

获取选定的索引的UITableView

我想要为UITableViewselect索引。 我写了下面的代码: NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0]; [tableView scrollToRowAtIndexPath:index atScrollPosition:UITableViewScrollPositionTop animated:YES]; 这总是适用于第一项。 我想在indexPathForRow.select索引indexPathForRow. 请帮忙。 谢谢。

如何调整UITableView的tableHeaderView?

我无法调整tableHeaderView的大小。 它简单不工作。 1)创build一个UITableView和UIView(100 x 320像素); 2)将UIView设置为UITableView的tableHeaderView; 3)build立和去。 一切都好。 现在,我想调整tableHeaderView,所以我添加这个代码在viewDidLoad: self.tableView.autoresizesSubviews = YES; self.tableView.tableHeaderView = myHeaderView; self.tableView.tableFooterView = myFooterView; CGRect newFrame = self.tableView.tableHeaderView.frame; newFrame.size.height = newFrame.size.height + 100; self.tableView.tableHeaderView.frame = newFrame; tableHeaderView的高度应该显示为200,但是显示为100。 如果我写: self.tableView.autoresizesSubviews = YES; CGRect newFrame = myHeaderView.frame; newFrame.size.height = newFrame.size.height + 100; myHeaderView.frame = newFrame; self.tableView.tableHeaderView = myHeaderView; self.tableView.tableFooterView = myFooterView; 然后从200的高度开始,如我所愿。 但我希望能够在运行时修改它。 […]