【问题标题】:subview frame of UITextfiled in uiscrollviewuiscrollview 中 UITextfiled 的子视图框架
【发布时间】:2013-11-30 05:34:15
【问题描述】:

我在添加按钮单击事件时在 UIScrollview 中添加 TextField,我想显示最后一个文本字段框架并在 UIScrollview 中显示。

我的代码:- [scrollview convertRect:subview.frame toView:someOtherView];

提前致谢

【问题讨论】:

  • 调整滚动视图位置
  • 我想显示最后一个文本框点击添加按钮
  • 你能说得更具体点吗...
  • @Rajneesh071 当我点击添加然后 texfiled 添加所以我想获得 uitextfiled 的框架
  • addBtn click里面的代码是什么

标签: iphone xcode uiscrollview ios7


【解决方案1】:
[scrView layoutSubviews];

我们只需要为滚动视图设置 layoutSubview 并为我工作。

【讨论】:

    【解决方案2】:

    如果列表中的数字要保持均匀分布,您可能应该使用 UITableView。很容易实现 UITableViewDataSource 来管理它的行,并且它免费提供动画。 UITableView 是 UIScrollView 的子类,因此您可以使用相同的 setContentOffset 方法,但使用索引路径更简洁。

    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:[tableView numberOfRowsInSection:0] inSection:0];
    [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 2011-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-06
      相关资源
      最近更新 更多