iOS: Emulate Android Xiaomi Mall head scrolling effect (multi-screen scrolling)

Source: Internet
Author: User

1. The previous application required this effect but was then implemented using a more complex (drawing) approach, and a new approach was now in mind.

2. Use of the http://www.cnblogs.com/yoon/p/3616503.html inside the tips

3. Ideas:

Mainly in the new ScrollView rewrite layoutsubviews

The code is as follows:

-(void  ) layoutsubviews{[    Super Layoutsubviews];  for  (UIView *view in   Self.subviews) { if  (View.tag = = 2014  ) {CGRect re            CT  = View.frame; rect.origin.x  =-self.superview.frame.size.width + Self.superview.frame.size.width/4 /2  
+ self.contentoffset.x/4 +self.contentoffset.x; View.frame = rect; } }}

Explanation, to ensure that the X coordinate is reasonable, and based on a few pages or a few screens to ensure a scrolling distance, so is self.contentoffset.x/4(scrolling distance, the current number of pages)

Full code:

Http://pan.baidu.com/s/1jGE98QM

PS: Material from Xiaomi Mall

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.