Latest 0.1
Homepage https://github.com/Ossey/SuspensionControl
License MIT
Platforms ios 7.0
Authors

iOS 屏幕滑动控件, 类似 AssistiveTouch 悬浮窗

image

使用方式

  1. 通过cocoaPods导入,在你的profile中添加

    pod 'SuspensionControl', '~> 0.1'

    或者直接将’SuspensionControl’ 添加到您的项目中

    1. 代码示例:
    • 一级菜单使用: 如果只需要在SuspensionMenuView上展示一级菜单,添加以下代码即可:
      
      /// 一级菜单使用:添加主菜单上的按钮
    • (void)oneLevelMenuSample {

    SuspensionMenuWindow menuView = [[SuspensionMenuWindow alloc] initWithFrame:CGRectMake(0, 0, 300, 300) itemSize:CGSizeMake(50, 50)];
    [menuView.centerButton setImage:[UIImage imageNamed:@"partner_boobuz"] forState:UIControlStateNormal];
    menuView.isOnce = YES;
    menuView.shouldOpenWhenViewWillAppear = NO;
    menuView.shouldHiddenCenterButtonWhenOpen = YES;
    menuView.shouldCloseWhenDeviceOrientationDidChange = YES;
    UIImage
    image = [UIImage imageNamed:@"mm.jpg"];
    menuView.backgroundImageView.image = image;
    menuView.delegate = self;

    NSMutableArray types = [NSMutableArray array];
    NSMutableArray
    images = [NSMutableArray array];
    int i = 0;
    while (i <= 7) {
    OSButtonType type = OSButtonType3;
    NSString imageNamed = @"aws-icon";
    if (i == 1) {
    type = OSButtonType1;
    imageNamed = @"apple-icon";
    }
    if (i == 2) {
    type = OSButtonType2;
    imageNamed = @"blip-icon";
    }
    if (i == 4) {
    type = OSButtonType4;
    imageNamed = @"dropbox-icon";
    }
    [types addObject:@(type)];
    [images addObject:imageNamed];
    i++;
    }
    i–;
    HypotenuseAction
    item = nil;
    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:OSButtonType1 handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setTitle:@"more" forState:UIControlStateNormal];
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:OSButtonType1 handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setTitle:@"sample" forState:UIControlStateNormal];
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    [menuView showWithCompetion:NULL];

    }

    
    - 多级菜单: 给对应的Action添加MoreAction,如下示例:
    
    • (void)sample {

    SuspensionMenuWindow menuView = [[SuspensionMenuWindow alloc] initWithFrame:CGRectMake(0, 0, 300, 300) itemSize:CGSizeMake(50, 50)];
    [menuView.centerButton setImage:[UIImage imageNamed:@"partner_boobuz"] forState:UIControlStateNormal];
    menuView.isOnce = YES;
    menuView.shouldOpenWhenViewWillAppear = NO;
    menuView.shouldHiddenCenterButtonWhenOpen = YES;
    menuView.shouldCloseWhenDeviceOrientationDidChange = YES;
    UIImage
    image = [UIImage imageNamed:@"mm.jpg"];
    menuView.backgroundImageView.image = image;
    menuView.delegate = self;

    NSMutableArray types = [NSMutableArray array];
    NSMutableArray
    images = [NSMutableArray array];
    int i = 0;
    while (i <= 7) {
    OSButtonType type = OSButtonType3;
    NSString imageNamed = @"aws-icon";
    if (i == 1) {
    type = OSButtonType1;
    imageNamed = @"apple-icon";
    }
    if (i == 2) {
    type = OSButtonType2;
    imageNamed = @"blip-icon";
    }
    if (i == 4) {
    type = OSButtonType4;
    imageNamed = @"dropbox-icon";
    }
    [types addObject:@(type)];
    [images addObject:imageNamed];
    i++;
    }
    i–;
    HypotenuseAction
    item = nil;
    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:OSButtonType1 handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setTitle:@"more" forState:UIControlStateNormal];

    {
    HypotenuseAction itemM = nil;
    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction
    _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:OSButtonType1 handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setTitle:@"more" forState:UIControlStateNormal];

    {
    HypotenuseAction itemM = nil;
    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction
    _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }

    {
    HypotenuseAction itemM = nil;
    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction
    _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }

    {
    itemM = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [itemM.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    [item addMoreAction:itemM];
    }
    }

    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    {
    item = [HypotenuseAction actionWithType:[types[i] integerValue] handler:^(HypotenuseAction * _Nonnull action) {

    }];
    [menuView addAction:item];
    [item.hypotenuseButton setImage:[UIImage imageNamed:images[i]] forState:UIControlStateNormal];
    if ([types[i] integerValue] == OSButtonType1) {
    [item.hypotenuseButton setSubtitle:@"Apple" forState:UIControlStateNormal];
    }
    i–;
    }

    [menuView showWithCompetion:NULL];

    }

Latest podspec

{
    "name": "SuspensionControl",
    "version": "0.1",
    "summary": "iOS u5c4fu5e55u6ed1u52a8u63a7u4ef6, u7c7bu4f3c AssistiveTouch u60acu6d6eu7a97.",
    "description": "u7c7bu4f3c iOS AssistiveTouch u60acu6d6eu7a97",
    "homepage": "https://github.com/Ossey/SuspensionControl",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Ossey": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/Ossey/SuspensionControl.git",
        "tag": "0.1"
    },
    "source_files": [
        "SuspensionControl",
        "SuspensionView/SuspensionView/SuspensionControl/**/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This