您的位置:首页 > 移动开发 > IOS开发

iOS开发 - 三方库实现聚光引导效果与触摸跟踪动效

2015-09-12 09:29 746 查看

效果展示



三方资源

EMHint:实现聚光灯效果;

COSTouchVisualizerWindow:实现触摸跟踪动效;

注意:三方资源直接附在Demo下载中,欢迎下载。

关键代码片段

EMHint

#pragma mark - 加载闪光灯

- (void)addSpotlight {

    CGFloat width = WITH/4;
    CGFloat centextY = HEIGHT - 50/2;

    // 创建闪光灯
    XSportLight *sportLight = [[XSportLight alloc] init];
    // 设置依次显示的文本
    sportLight.messageArray = @[@"这是一个主页界面",
                                @"这是一个消息界面",
                                @"这是一个音乐界面",
                                @"这是一个动态界面",
                                @"动画引导结束"];
    // 设置依次显示的位置
    // 注意:CGRectMake 中,x、y值设置的 聚光灯 中心点在屏幕的位置。
    sportLight.rectArray = @[[NSValue valueWithCGRect:CGRectMake(width/2, centextY, 50, 50)],
                             [NSValue valueWithCGRect:CGRectMake(width+width/2, centextY, 50, 50)],
                             [NSValue valueWithCGRect:CGRectMake(2*width+width/2, centextY, 50, 50)],
                             [NSValue valueWithCGRect:CGRectMake(3*width+width/2, centextY, 50, 50)],
                             [NSValue valueWithCGRect:CGRectMake(0, 0, 0, 0)],];
    sportLight.delegate = self;
    [self presentViewController:sportLight animated:false completion:nil];
}


COSTouchVisualizerWindow

AppDelegate.h

#import <UIKit/UIKit.h>
#import "COSTouchVisualizerWindow.h"

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) COSTouchVisualizerWindow *window;

@end


AppDelegate.m

#import "AppDelegate.h"
#import "TabBarViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;

    _window = [[COSTouchVisualizerWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];

    _window.backgroundColor = [UIColor blackColor];

    _window.rootViewController = [[TabBarViewController alloc] init];

    [_window makeKeyAndVisible];

    return YES;
}

@end


Demo下载

下载地址:http://download.csdn.net/detail/hierarch_lee/9100121
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: