Latest 1.0.2
Homepage https://github.com/Bupterambition/MGJPFIntroguideView
License MIT Copyright (c) 2011 Masashi Ono.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Platforms ios 7.0, requires ARC
Dependencies MGJRouter
Authors

Version
License
Platform

MGJPFIntroGuideView is an iOS drop-in class that displays user coach marks with a rectangular or star or circular cutout over an existing UI. This approach leverages your actual UI as part of the onboarding process for your user. Simply define an array of views or dictionary (Hard code ) or rectangles (CGRect) and their accompanying captions,what’s more you can also define an extro display image to intro your view with url or local resource ,even you can add a click link on the guiding image.for example you can define the url of image – https://www.google.com , so when user click the guiding image your app will open https://www.google.com. Furthermore,you can even define a route url of your app.

image
image
image

Installation

CocoaPods

MGJPFIntroGuideView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'MGJPFIntroguideView'

Source files

Alternatively, you can directly add the MGJPFIntroGuideView.h and MGJPFIntroGuideView.m source files to your project what’s more you should add MGJRouter to your project.

Example

Create a new MGJPFIntroGuideView instance in your viewDidLoad or viewDidLayoutSubviews method and pass in an array of views or dictionaries.


- (void)viewDidLayoutSubviews {
    if (self.coachMarksShown == NO  && self.introduceArray.count) {
        [self.coachMarksView loadMarks:self.introduceArray];
        NSMutableArray *array = [NSMutableArray array];
        for (NSUInteger index = 0 ; index < self.introduceArray.count; index ++) {
            [array addObject:[NSString stringWithFormat:@"this is the %ld picture",index]];
        }
        [self.coachMarksView loadGuideImageUrl:introGuideImgUrl withPoint:(CGPoint){70,100} redirectURL:@"http://www.mogujie.com/" withFrequency:0];
        [self.coachMarksView start];
    }
}

#pragma mark - UICollectionViewDataSource

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 20;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    if (indexPath.row %5 == 0 && self.introduceArray.count <=3 && indexPath.row != 0) {
        [self.introduceArray addObject:cell];
    }
    cell.backgroundColor = [UIColor colorWithRed:arc4random()%100/100. green:arc4random()%100/100. blue:arc4random()%100/100. alpha:arc4random()%100/100.];
    return cell;
}

#pragma mark - Accessor

- (MGJPFIntroGuideView *)coachMarksView {
    if (!_coachMarksView) {
        _coachMarksView = [[MGJPFIntroGuideView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    }
    return _coachMarksView;
}

if you want to control the frame of each coachMask,you can use the NSArray of NSDictionary below

- (void)viewDidLoad {
    [super viewDidLoad];

    // ...

    // Setup coach marks
    NSArray *coachMarks = @[
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{0,0},{45,45}}],
            @"caption": @"Helpful navigation menu"
            @"shape": @"circle"
        },
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{10.0f,56.0f},{300.0f,56.0f}}],
            @"caption": @"Document your wedding by taking photos"
            @"shape": @"square"
        },
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{10.0f,119.0f},{300.0f,56.0f}}],
            @"caption": @"Your wedding photo album"
        },
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{10.0f,182.0f},{300.0f,56.0f}}],
            @"caption": @"View and manage your friends & family"
        },
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{10.0f,245.0f},{300.0f,56.0f}}],
            @"caption": @"Invite friends to get more photos"
        },
        @{
            @"rect": [NSValue valueWithCGRect:(CGRect){{0.0f,410.0f},{320.0f,50.0f}}],
            @"caption": @"Keep your guests informed with your wedding details"
        }
    ];
    MGJPFIntroGuide *coachMarksView = [[MGJPFIntroGuide alloc] initWithFrame:self.view.bounds coachMarks:coachMarks];
    [self.view addSubview:coachMarksView];
    [coachMarksView start];
}

If you’d like to take a certain action when a specific coach mark comes into view, you can define the callback Block of MGJPFIntroGuideView


- (void)setUpCoachMarksViewCallBack {
    self.coachMarksView = [[MGJPFIntroGuideView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.coachMarksView.completionBlock = ^(MGJPFIntroGuideView *guideView){
        NSLog(@"%@",guideView);
    };
    self.coachMarksView.willCompletionBlock = ^(MGJPFIntroGuideView *guideView){
        NSLog(@"%@",guideView);
    };
    self.coachMarksView.didNavgateBlock = ^(MGJPFIntroGuideView *guideView, NSUInteger indedx) {
        NSLog(@"%@",guideView);
    };
    self.coachMarksView.willNavgateBlock = ^(MGJPFIntroGuideView *guideView, NSUInteger indedx) {
        NSLog(@"%@",guideView);
    };
}

#pragma mark - Accessor

- (MGJPFIntroGuideView *)coachMarksView {
    if (!_coachMarksView) {
        _coachMarksView = [[MGJPFIntroGuideView alloc] initWithFrame:[UIScreen mainScreen].bounds];
        _coachMarksView.loadType = MGJPFIntroLoad_Sync;
    }
    return _coachMarksView;
}

More Detail

just clone the repo , check the my code

Author

senmiao, [email protected]

License

AwesomeCommand is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MGJPFIntroGuideView",
    "version": "1.0.2",
    "summary": "u4e00u4e2au597du7528u7684u7528u6237u6307u5bfcu9875",
    "description": "u4e00u4e2au597du7528u7684u7528u6237u6307u5bfcu9875uff0cu53efu4ee5u751fu6210u56dbu79cdu4e0du540cu7684u6355u83b7u56feu5f62uff0cu63d0u4f9bu4e86u591au79cdu65b9u6cd5u8fdbu884cu521du59cbu5316uff0cu53efu4ee5u6ee1u8db3u5404u79cdu4e1au52a1u9700u6c42",
    "homepage": "https://github.com/Bupterambition/MGJPFIntroguideView",
    "license": {
        "type": "MIT",
        "text": "                  Copyright (c) 2011 Masashi Ono.n                  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:n                  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.n                  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.n"
    },
    "authors": {
        "Bupterambition": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Bupterambition/MGJPFIntroguideView.git",
        "tag": "1.0.2"
    },
    "source_files": "*.{h,m}",
    "public_header_files": "*.h",
    "requires_arc": true,
    "dependencies": {
        "MGJRouter": []
    }
}

Pin It on Pinterest

Share This