• <small id='mqNwg'></small><noframes id='mqNwg'>

    <tfoot id='mqNwg'></tfoot>
    1. <i id='mqNwg'><tr id='mqNwg'><dt id='mqNwg'><q id='mqNwg'><span id='mqNwg'><b id='mqNwg'><form id='mqNwg'><ins id='mqNwg'></ins><ul id='mqNwg'></ul><sub id='mqNwg'></sub></form><legend id='mqNwg'></legend><bdo id='mqNwg'><pre id='mqNwg'><center id='mqNwg'></center></pre></bdo></b><th id='mqNwg'></th></span></q></dt></tr></i><div id='mqNwg'><tfoot id='mqNwg'></tfoot><dl id='mqNwg'><fieldset id='mqNwg'></fieldset></dl></div>

        <bdo id='mqNwg'></bdo><ul id='mqNwg'></ul>
    2. <legend id='mqNwg'><style id='mqNwg'><dir id='mqNwg'><q id='mqNwg'></q></dir></style></legend>

      1. 单击按钮滚动 UIScrollView

        时间:2023-07-30
          <tbody id='7PNc0'></tbody>

        <tfoot id='7PNc0'></tfoot>
            <bdo id='7PNc0'></bdo><ul id='7PNc0'></ul>

            <legend id='7PNc0'><style id='7PNc0'><dir id='7PNc0'><q id='7PNc0'></q></dir></style></legend>

            <small id='7PNc0'></small><noframes id='7PNc0'>

            1. <i id='7PNc0'><tr id='7PNc0'><dt id='7PNc0'><q id='7PNc0'><span id='7PNc0'><b id='7PNc0'><form id='7PNc0'><ins id='7PNc0'></ins><ul id='7PNc0'></ul><sub id='7PNc0'></sub></form><legend id='7PNc0'></legend><bdo id='7PNc0'><pre id='7PNc0'><center id='7PNc0'></center></pre></bdo></b><th id='7PNc0'></th></span></q></dt></tr></i><div id='7PNc0'><tfoot id='7PNc0'></tfoot><dl id='7PNc0'><fieldset id='7PNc0'></fieldset></dl></div>

                  本文介绍了单击按钮滚动 UIScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想知道我是否可以通过单击 UIButton 来滚动 UIScrollView,如果可以,有人可以告诉我如何操作.

                  I would like to know if it is possible for me to scroll a UIScrollView on the click of a UIButton and if so, would someone be able to tell me how to.

                  目前我正在使用下面的代码来查看滚动视图的左侧是否有更多内容,如果有,则显示一个图像,告诉用户如果他们向左滚动,会有更多内容.我想实现一个功能,我添加一个 UIButton 而不是图像,当左侧有更多内容可用并且当用户单击按钮时,滚动视图将滚动到左侧.

                  currently I am using the below code to see if in the scrollview more content is there to its left and if it is there, display an image which would tell the users that there is more content if they scroll to the left. I would like to implement a functionality where I add a UIButton instead of the image and when more content is available on the left and when the user clicks the button, the scrollview would scroll to its left.

                  - (void)scrollViewDidScroll:(UIScrollView *)scrollView1 {
                      if (scrollView1.contentOffset.x == scrollView1.contentSize.width - scrollView1.frame.size.width) 
                      {        
                          // reached the right
                          self.imageView.hidden = YES;
                      }
                  
                      else
                      {
                          self.imageView.hidden = NO;
                      }
                  }
                  

                  如果有人能帮我解决这个问题,那就太好了.

                  It would be great if someone could help me out on this.

                  推荐答案

                  我认为这很简单.使用:

                  That's pretty easy, I think. Use:

                  [scrollView1 setContentOffset:CGPointMake(x, 0) animated:YES];
                  

                  其中 X 是 scrollView1.contentOffset.x + scrollView1.contentSize.width 的值.

                  Where X is the value of scrollView1.contentOffset.x + scrollView1.contentSize.width.

                  这篇关于单击按钮滚动 UIScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何根据 iphone 中的文本大小动态增加按钮宽度? 下一篇:UIButton - 文本被截断

                  相关文章

                • <small id='QVpht'></small><noframes id='QVpht'>

                  <legend id='QVpht'><style id='QVpht'><dir id='QVpht'><q id='QVpht'></q></dir></style></legend>

                      • <bdo id='QVpht'></bdo><ul id='QVpht'></ul>
                      <tfoot id='QVpht'></tfoot>

                      <i id='QVpht'><tr id='QVpht'><dt id='QVpht'><q id='QVpht'><span id='QVpht'><b id='QVpht'><form id='QVpht'><ins id='QVpht'></ins><ul id='QVpht'></ul><sub id='QVpht'></sub></form><legend id='QVpht'></legend><bdo id='QVpht'><pre id='QVpht'><center id='QVpht'></center></pre></bdo></b><th id='QVpht'></th></span></q></dt></tr></i><div id='QVpht'><tfoot id='QVpht'></tfoot><dl id='QVpht'><fieldset id='QVpht'></fieldset></dl></div>