Analysis of iOS development & quot; secret & quot; Page Effect of App content (2), iosapp

Source: Internet
Author: User

Analysis of iOS development: "secret" App content page effect (2), iosapp

@ I wrote a "secret" Cell effect article a few days ago, but there is still a gap with the desired effect at work, and the scalability is poor, so I rewrite the encapsulation, put the overall view into the scrollView, which is basically the same effect as the secret app.

@ The Code is as follows: (the fuzzy effect class will not be written. You can search for "UIImage + ImageEffects" and import Accelerate. framework)

1. MTSecretAppEffect. h

# Import <Foundation/Foundation. h> @ interface MTSecretAppEffect: NSObject/*** creates an overall scrollView and loads headScrollView and tableView on it to slide up and down, all other slides are not allowed ** @ return mainScrollView */-(UIScrollView *) createMainScrollView;/*** create headScrollView ** @ return headScrollView */-(UIScrollView *) createHeadScrollView; /*** create a Fuzzy view of the header ** @ param scrollview headScrollView ** @ return blurImageView */-(UIImageView *) createBlurImageViewOfView :( UIScrollView *) scrollview; /*** in-(void) scrollViewDidScroll :( UIScrollView *) method called in scrollView ** @ param scrollView * @ param mainScrollView * @ param tableView * @ param headScrollView * @ param blurImageView */-(void) scrollDidScrollView :( UIScrollView *) scrollView withMainScrollView :( UIScrollView *) mainScrollView withTableView :( UITableView *) tableView withHeadScrollView :( UIScrollView *) headScrollView withBlurImageView :( UIImageView *) blurImageView @ end

2. MTSecretAppEffect. m

# Import "MTSecretAppEffect. h "# import" UIImage + ImageEffects. h "# import <QuartzCore/QuartzCore. h> # define HEADER_HEIGHT 200366f # define export CGRectMake (0, 0,320, HEADER_HEIGHT) const CGFloat kBarHeight = 50366f; const CGFloat ceiling = 0.5f; const CGFloat kBlurFadeInFactor = 0.015f; @ implementation MTSecretAppEffect // missing: the caller sets the proxy-(UIScrollView *) createMainScrollView {// and Self. view is the same as the bottom ScrollView UIScrollView * mainScrollView = [[UIScrollView alloc] initWithFrame: [UIApplication sharedApplication]. keyWindow. frame]; mainScrollView. bounces = YES; mainScrollView. alwaysBounceVertical = YES; mainScrollView. contentSize = CGSizeZero; mainScrollView. showsVerticalScrollIndicator = YES; mainScrollView. returns mainScrollView;}-(UIScrollView *) createHeadScrollView {response * headScrollView = [[UIScrollView alloc] initWithFrame: callback]; headScrollView. scrollEnabled = NO; headScrollView. contentSize = CGSizeMake (320,100 0); return headScrollView;}-(UIImageView *) createBlurImageViewOfView :( UIScrollView *) scrollview {uigraphicsbeginimagecontextwitexceptions (scrollview. bounds. size, scrollview. opaque, 0.0); [scrollview. layer renderInContext: UIGraphicsGetCurrentContext ()]; UIImage * img = partial (); UIImageView * blurImageView = [[UIImageView alloc] initWithFrame: CGRectMake (0, 0,320, HEADER_HEIGHT)]; blurImageView. image = [img applyBlurWithRadius: 12 tintColor: [UIColor colorWithWhite: 0.8 alpha: 0.4] saturationDeltaFactor: 1.8 maskImage: nil]; blurImageView. autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; blurImageView. alpha = 0; blurImageView. backgroundColor = [UIColor clearColor]; return blurImageView;}-(void) preview :( UIScrollView *) scrollView preview :( optional *) mainScrollView withTableView :( UITableView *) tableView preview :( UIScrollView *) headScrollView withBlurImageView :( UIImageView *) blurImageView {CGFloat y = 0.0f; CGRect rect = HEADER_INIT_FRAME; if (scrollView. contentOffset. y <0.0f) {// pull down to increase the effect y = fabs (MIN (0.0f, mainScrollView. contentOffset. y); headScrollView. frame = CGRectMake (CGRectGetMinX (rect)-y/2.0f, CGRectGetMinY (rect)-y, CGRectGetWidth (rect) + y, CGRectGetHeight (rect) + y );} else {y = mainScrollView. contentOffset. y; blurImageView. alpha = MIN (1, y * kBlurFadeInFactor); CGFloat backgroundScrollViewLimit = headScrollView. frame. size. height-kBarHeight; if (y> backgroundScrollViewLimit) {headScrollView. frame = (CGRect ){. origin = {0, y-headScrollView. frame. size. height + kBarHeight },. size ={ 320, HEADER_HEIGHT }}; tableView. frame = (CGRect ){. origin = {0, CGRectGetMinY (headScrollView. frame) + CGRectGetHeight (headScrollView. frame )},. size = tableView. frame. size}; tableView. contentOffset = CGPointMake (0, y-Batch); CGFloat contentOffsetY =-rows * Rows; [headScrollView setContentOffset :( CGPoint) {0, rows} animated: NO];} else {headScrollView. frame = rect; tableView. frame = (CGRect ){. origin = {0, CGRectGetMinY (rect) + CGRectGetHeight (rect )},. size = tableView. frame. size}; [tableView setContentOffset :( CGPoint) {0, 0} animated: NO]; [headScrollView setContentOffset: CGPointMake (0,-y * kBackgroundParallexFactor) animated: NO ];}

3. main. m

# Import "RootViewController. h "# import" CommentCell. h "# import" MTSecretAppEffect. h "# define HEADER_HEIGHT 200366f @ interface RootViewController () <strong, UITableViewDataSource, UITableViewDelegate> @ property (nonatomic, strong) returns * secretEffect; // secretApp effect object @ property (nonatomic, strong) UIScrollView * mainScrollView; // scrollView with the same size as view @ property (nonatomic, strong) UI ScrollView * headScrollView; // @ property (nonatomic, strong) UIImageView * blurImageView; // @ property (nonatomic, strong) UITableView * tableView; // @ end @ implementation RootViewController-(void) viewDidLoad {[super viewDidLoad]; // 0. create the SecretApp effect object self. secretEffect = [[MTSecretAppEffect alloc] init]; // 1. scrollView self. mainScrollView = [self. secretEffect createMainScrollView]; self. mainS CrollView. delegate = self; self. view = self. mainScrollView; // 2. head background View self. headScrollView = [self. secretEffect createHeadScrollView]; // 3. background Image view UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (0, 0,320, HEADER_HEIGHT)]; imageView. image = [UIImage imageNamed: @ "secret.png"]; imageView. autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [Self. headScrollView addSubview: imageView]; // 4. fuzzy View _ blurImageView = [self. secretEffect createBlurImageViewOfView: self. headScrollView]; [self. headScrollView addSubview: _ blurImageView]; // 5. tableView self. tableView = [[UITableView alloc] initWithFrame: CGRectMake (0, HEADER_HEIGHT, CGRectGetWidth (self. view. frame), CGRectGetHeight (self. view. frame)-50) style: UITableViewStylePlain]; self. tableVi Ew. scrollEnabled = NO; self. tableView. delegate = self; self. tableView. dataSource = self; self. tableView. tableFooterView = [[UIView alloc] initWithFrame: CGRectZero]; self. tableView. separatorColor = [UIColor clearColor]; // 6. add view [self. view addSubview: self. headScrollView]; [self. view addSubview: self. tableView]; // 7. set self. mainScrollView. contentSize = CGSizeMake (320, self. tableView. contentSize. h Eight + CGRectGetHeight (self. headScrollView. frame);}-(void) scrollViewDidScroll :( UIScrollView *) scrollView {// 8. call method [self. secretEffect scrollDidScrollView: scrollView withMainScrollView: self. mainScrollView withTableView: self. tableView withHeadScrollView: self. headScrollView withBlurImageView: self. blurImageView] ;}# pragma mark-hide the status bar-(BOOL) prefersStatusBarHidden {return YES ;}# pragma mark-UITa BleView dataSource-(NSInteger) numberOfSectionsInTableView :( UITableView *) tableView {return 1;}-(NSInteger) tableView :( UITableView *) tableView numberOfRowsInSection :( NSInteger) section {return 20 ;} -(CGFloat) tableView :( UITableView *) tableView preview :( NSIndexPath *) indexPath {return 40;}-(UITableViewCell *) tableView :( UITableView *) tableView cellForRowAtIndexPath :( NSIndexPath *) I NdexPath {CommentCell * cell = [tableView dequeueReusableCellWithIdentifier: [NSString stringWithFormat: @ "Cell % ld", indexPath. row]; if (! Cell) {cell = [[CommentCell alloc] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: [NSString stringWithFormat: @ "Cell % ld", indexPath. row];} cell. textLabel. text = [NSString stringWithFormat: @ "section = % ld row = % ld", indexPath. section, indexPath. row]; return cell;}-(void) didReceiveMemoryWarning {[super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated .} @ end
@:




During ios development and application submission, the development certificate and the App IDs

1. Develop a certificate for development and install it on a mac computer.
2. if you want to perform a real machine test, you need a profile and register the device you used for the test in this profile (A Personal Development Account can register 100 devices). This profile can be generated on the official website, and download it to the local machine.
3. If you want to publish data to the app store, your program requires an app id. Each program corresponds to an app id. In addition, you need to bind a release profile to the app id. The app id indicates the special functions required by your program, such as push and icowould. The app id must be indicated in the bundle settings of the program. The name must be the same as that on the Internet.
I have released several programs. The above are regular channel releases and no cracking releases. They are for reference only and hope they can help you.

How to obtain the app list in ios development

The APIS published by Apple cannot obtain the list of installed apps. Unless it is a private api, it cannot be approved by Apple.
 

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.