Tag: uitableview

UITextView InputView UITableViewController

我试图实现一个重写UITextViews InputView的TableView,为用户提供一个可search的TableView,然后用选定的值填充UITextField。 我已经search了一个公平的位,我find的最接近的解决scheme是这个,但我不知道如何将UITableViewController与我的UITextViews InputView关联? 我可以看到这些函数在MultiSelectPicker中被调用… override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int override func numberOfSectionsInTableView(tableView: UITableView) -> Int 但是,这些不是我相当确定的解释为什么我没有看到填充在表视图中的任何东西。 override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? 我已经改变了didSet,所以我知道reloadData被从主线程调用,仍然没有。 var items = [NSObject](){ didSet{ dispatch_async(dispatch_get_main_queue(),{ self.tableView.reloadData() }); } } 它可能是我在我的主viewcontroller中设置inputView的方式,但我相当新的iOS和Swift,所以我可能缺less一些基本的东西。 @IBOutlet weak var mspEmployee: […]

从横向到纵向改变方向时,横向宽度减小

我使用tableview与search栏显示控制器,它显示良好的portait和横向视图,但从横向旋转search栏大小减less,如何更改原始大小

TableViewCell堆积并出现一次又一次

我用ADLively TableView实现了TableView。 但是,如果我滚动tableView,单元格的文本成为一堆又一堆…. 使用“cell.textLabel”是好的,添加UILabel并不好,但如果我使用“cell.textLabel”,我不能调整textLabel的宽度。 (我想在文本的左侧和右侧添加UIImageView) 所以现在我用这种方式来添加UILabel。 我该怎么办? 这是代码。 – (void)viewDidLoad { CGRect rect = CGRectMake(0, 50, 320, self.view.frame.size.height-150); self.tableView = [[ADLivelyTableView alloc]initWithFrame:rect style:UITableViewStylePlain]; self.tableView = (ADLivelyTableView *)self.tableView; self.tableView.initialCellTransformBlock = ADLivelyTransformFan; self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; [self.view addSubview: self.tableView]; //self.tableView.backgroundColor = [UIColor blueColor]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; } – (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section […]

更新TableViewController中的variables

我需要更新TableViewController中的variables,我不能find办法做到这一点,有人可以解释为什么这是行不通的吗? 我生气了 从我的视图控制器这是我正在运行的代码: let storyboard = UIStoryboard(name: "Main", bundle: nil) let TV = storyboard.instantiateViewControllerWithIdentifier("tbController") as myTableViewController TV.x = "test" 然后,从TableViewController类: class myTableViewController: UITableViewController { var x:String! override func viewDidLoad() { super.viewDidLoad() println("Value of x is: \(self.x)") } } 印刷的价值是:无 为什么? 那有什么问题? 我不明白:-( 更新的图片

直接从textField移动到textField时,UITableView不会移动

我目前正在与我的基于Swift的iPhone应用程序覆盖一些textField问题的键盘作战。 这张图片显示了主要问题(前三张图片显示了问题,最后三张是应该做的): 当tableViewCell中的textField被编辑时,我想要移动整个tableview和导航栏。 我可以用下面的代码(取自viewController的片段)做到这一点: var tableViewShiftedUp = false … func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! QuantityTableViewCell let componentLocationQuantity = tableViewData[indexPath.row] if let locationString = componentLocationQuantity.location.valueForKey("location_name") as? String { cell.setCellContents(locationString, quantity: componentLocationQuantity.quantity.floatValue) cell.quantityLabel.delegate = self } //get stock level related to current build rate and lead […]

ios表格按行索引的顺序查看单元格加载图像

在表格视图中configuration单元格,我使用 -(void)setImageWithURLRequest:(NSURLRequest *)urlRequest placeholderImage:(UIImage *) 方法从AFNetworking到加载单元格图像(把它放在cellForRowAtIndexPath)从网站 用户在加载时不会卡住滚动。 – – – – – – – – – – 问题是每个图像都以随机顺序显示 因为这个方法发送asynchronous请求, 但我希望他们一个接一个地显示, 例如行1单元格中的图像必须显示在行0单元格中的图像之后,等等 这就像加载可以是asynchronous的(它必须是)… 但显示器应该是同步的(按顺序!) 是否有捷径可寻? 提前致谢

在uitableviewcell中的子视图中的uibutton没有按照条件回滚后更新

– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"cell"; UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier forIndexPath:indexPath]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier]; } tv.rowHeight = UITableViewAutomaticDimension; tv.estimatedRowHeight = 44.0; [cell setNeedsUpdateConstraints]; [cell updateConstraintsIfNeeded]; NSDictionary *Data5 = [pro1 objectAtIndex:indexPath.row]; NSString *name = [Data5 objectForKey:@"handle"]; UIButton *c3 = […]

如何通过故事板自动布局来适应tableview到导航栏下的superview

我想创build一个滚动禁用的tableview将填充导航栏下方的视图。 最后,我已经设法做到了,但这不是正确的方法,因为我给了tableview的负64边界(状态栏+导航栏)。 我正在从故事板分配我的约束。 我已经尝试了许多其他的约束与表视图像从四边或等宽+相等的高度+中心水平+中心垂直零约束没有任何工作。 什么是解决这个问题的正确途径。 下面是故事板的屏幕截图。

cachingtableView单元格数据

在我的应用程序中,我使用URL下载一些图像,并将它们放在cell.imageView[indexPath.row] (这是一个带有cell.imageView[indexPath.row]的自定义单元格)。 我一次可以看到两个单元格,并且注意到了这个方法 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> CustomCell { } 每当单元格被显示时都会调用它。 所以我的应用程序继续下载从服务器的图像和应用程序结果非常缓慢。 我想知道是否有可能caching我已经看到的细胞的数据,所以我不需要重新下载图像,如果我在我的tableView向上滚动! 代码说话我只想调用上面写的func只有当我向下滚动表格,而不是我已经看到的单元格。

隐藏UITableviewcell的UIButton

我的代码中有一个简单的关键问题。 当我按下我的编辑button(这是在导航栏上)我的桌面视图它需要我编辑UITableview的方法。 我想隐藏“我的手机”上的button和标签。 代码: 我正在像这样添加我的Button // Customize the appearance of table view cells. – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *currentCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; currentCell = nil; if (currentCell==nil) { currentCell=[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } BtnEmail=[UIButton buttonWithType:UIButtonTypeCustom]; //BtnEmail = (UIButton *)[currentCell viewWithTag: 3]; BtnEmail.frame=CGRectMake(265, 17, 25, 25); BtnEmail.tag=indexPath.row; //[BtnEmail […]