iPhone: Expand UITextView when scrolling

允我心安 提交于 2019-12-11 19:25:01

问题


in my iPhone Application I have a UIImageView on the top and a UITextView below that. I want the UITextView to expand to the upper site and cover the UIImageView once the User starts scrolling.

A similar effect can be found in the Rdio Application. There you can view the cover on the top and the upcoming title below, once the user starts to scroll, the upcoming titles view expands and covers the cover.

How can that be done?

Thanks.


回答1:


Try to use one of the delegate methods of UIScrollView (UITextView is a subview of UIScrollView).

This should work for you:

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
    // From Apple Docs: Tells the delegate when the scroll view is about to start scrolling the content.

Implement this method and call your resizing function in it.



来源:https://stackoverflow.com/questions/17813881/iphone-expand-uitextview-when-scrolling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!