【问题标题】:How lower the uitextview current position in landscape mode?在横向模式下如何降低 uitextview 当前位置?
【发布时间】:2010-11-23 13:03:30
【问题描述】:

我有一个滚动视图,它包含一个 uitextfield、一个 uitextview 和两个标签 uitextfield 和两个标签不滚动。 在纵向模式下一切正常。 在横向模式下,我以标签不可见的方式调整滚动视图的大小,只保留标题和文本视图,但是当用户尝试在文本视图中插入文本时出现问题。当前位置在标题下方,因此用户看不到他/她插入的内容。我会降低它。 在 IB 中使用自动调整大小的掩码,不要改变这种情况:我只需要使 uitextview 变得灵活。 我可以尝试什么? 我认为 scrollRangeToVisible 可以帮助我,但没有。

【问题讨论】:

    标签: ios uiscrollview uitextview landscape cursor-position


    【解决方案1】:

    尝试使用

    - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
    

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    

    在您的视图控制器中,根据方向将您的 uiTextView 放置在您需要的位置。将 textview 的框架更改为视觉效果。我认为第一种方法忽略了 IB 的大小调整掩码,因此您必须使用 CGRectMake 为对象的框架设置坐标。第二种方法将根据调整大小的蒙版为旋转设置动画,但随后会“突然”将对象移动到您指定它们的帧所在的位置(再次使用 CGRectMake)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-20
      • 1970-01-01
      • 1970-01-01
      • 2012-05-20
      相关资源
      最近更新 更多