iOS design mode-appearance

Source: Internet
Author: User

iOS design mode-appearance

Schematic diagram

Description

1. When the customer service side needs to use a complex subsystem (the relationship between subsystems is complex), but do not want to have a relationship with them, we need to write a separate class to interact with the subsystem, isolate the client-to-subsystem connection, the client only with this separately written class interaction

2. The appearance mode essentially provides a unified interface for a set of interfaces in the system, and the appearance defines a high-level interface that makes the subsystem easy to use

Source

Https://github.com/YouXianMing/FacadePattern

////ShapeMaker.h//Facadepattern////Created by youxianming on 15/7/28.//Copyright (c) 2015 youxianming. All rights reserved.//#import<Foundation/Foundation.h>#import "Shape.h"#import "Circle.h"#import "Rectangle.h"#import "Square.h"@interfaceShapemaker:nsobject+ (void) Drawcircleandrectangle;+ (void) Drawcircleandsquare;+ (void) Drawall;@end
////SHAPEMAKER.M//Facadepattern////Created by youxianming on 15/7/28.//Copyright (c) 2015 youxianming. All rights reserved.//#import "ShapeMaker.h"@implementationShapemaker+ (void) Drawcircleandrectangle {Shape*circle = [CircleNew]; Shape*rectangle = [RectangleNew];    [Circle Draw];    [Rectangle draw]; NSLog (@"\ n");}+ (void) Drawcircleandsquare {Shape*circle = [CircleNew]; Shape*square = [SquareNew];    [Circle Draw];    [Square Draw]; NSLog (@"\ n");}+ (void) Drawall {Shape*circle = [CircleNew]; Shape*rectangle = [RectangleNew]; Shape*square = [SquareNew];    [Circle Draw];    [Rectangle draw];    [Square Draw]; NSLog (@"\ n");}@end
 // //  //  Facadepattern  // //  Created by youxianming on 15/7/28.< /span>//  Copyright (c) 2015 youxianming. All rights reserved.  //  #import  <foundation/foundation.h>@ Interface   Shape:nsobject  /*  Span style= "color: #008000;" >* * Draw  */-(void  ) draw;   @end  
////SHAPE.M//Facadepattern////Created by youxianming on 15/7/28.//Copyright (c) 2015 youxianming. All rights reserved.//#import "Shape.h"@implementationShape- (void) Draw {//overridden by subclasses}@end

Analysis

Detailed comparison

iOS design mode-appearance

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.