ios learn four essays

Page-Base Application :
As an application template e-book
1 on the data source, first check to RootViewController of ViewDidLoad method of a datasource source --ModelController
The method provides a method 2ModelController initial source of the data and display content
Master-Detail Application:
Provide a template as a notepad application
There are a variety of methods to add item
 
Matching parent container:
Said parent container is a view of the container where, by setting the vertical and horizontal margins adapt it to various screen sizes
By editor-> pin vertically disposed right and left margins
Dividing parent container:
Requirements: dividing containers to adapt the rotation of the screen -> by setting the margin line
The spacing between the sub-tank is different pitches by different levels
The sub-tank according to a certain proportion within the parent vessel, the parent vessel remember to set the margins view, first of all parent container viewcontroller equivalent based on all view of the above it
 
Custom Round progress indicator --- This example shows
import UIKit
class progresscustom: UIView {
    override init(frame: CGRect) {
    super.init(frame: frame)
        self.backgroundColor = UIColor(white: 1, alpha: 0)
    }

    required init(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private var _progressValue :CGFloat = 0
      
    internal func getProgressVlue() ->CGFloat{
        return _progressValue ;
    }
  internal func setProgressValue(value : CGFloat){
        _progressValue = value ;
        setNeedsDisplay() ;
    }
    
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.当子图需要表现在VIew上的时候,需要重写这个方法
    override func drawRect(rect: CGRect) {
        // Drawing code
        var ctx = UIGraphicsGetCurrentContext() ;
        var r = rect.width/2       
        CGContextAddArc(ctx,r, r, r, 0, 3.1415926*2, 0)
        CGContextAddLineToPoint(ctx, r, r)
        CGContextSetRGBFillColor(ctx, 0.7, 0.7, 0.7, 1)
        CGContextFillPath(ctx)
        CGContextAddArc(ctx,r, r, r, 0, 3.1415926*2*_progressValue, 0)
        CGContextAddLineToPoint(ctx, r, r)
        CGContextSetRGBFillColor(ctx, 0, 0, 1, 1)
        CGContextFillPath(ctx)
        CGContextStrokePath(ctx)
        CGContextSetLineWidth(ctx, 5)
    }
Custom real-time preview effect:
You can add your own set of attributes for the control
1: To access to this property in the Properties window, first Add Target -Cocoa touch framework on the back of project
Add Class 2 In this framework, add keywords @IBDesignable before class
3 each need to add the attributes you need to add keywords @IBInspectable
4 property, there are a didSet. . . . . layer is used in the body of the original properties
Five pairs of control on the storyboard adding the class, and can view on this property inspector
 
IOS switch the view: Switch ---- static method between pictures
UIView.transitionFromView(cyndi1, toView: cyndi2, duration: 1, options: UIViewAnimationOptions.TransitionFlipFromLeft, completion: nil)
By the above method is switched from cyndi1 to cyndi2, option mode is switched, the function switching process is performed Completion may be nil
Of course, can be directly switched back and forth two images by setting a bool
 
IOS view animation
1 to animate
UIView.beginAnimations (nil, context: nil) // must
// set properties
UIView.seAnimationTransition(UIViewAnimationTransition.CurlDown.     ,...)
UIView.setAnimationDuration (1.0)
2 final must be submitted UIView.commitAnimations ()
IOS custom animation
UIView.transitionWithView () to set
 
 

Reproduced in: https: //www.cnblogs.com/KyleRuan/p/4296135.html

Guess you like

Origin blog.csdn.net/weixin_34205076/article/details/93435603