mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 16:58:38 +09:00
Dactyloidae iOS initial commit
This commit is contained in:
parent
daa6179d22
commit
7154a0497e
2123 changed files with 197052 additions and 0 deletions
25
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.h
vendored
Normal file
25
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.h
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// NSMutableArray+SWUtilityButtons.h
|
||||
// SWTableViewCell
|
||||
//
|
||||
// Created by Matt Bowman on 11/27/13.
|
||||
// Copyright (c) 2013 Chris Wendel. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NSMutableArray (SWUtilityButtons)
|
||||
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color title:(NSString *)title;
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color attributedTitle:(NSAttributedString *)title;
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color icon:(UIImage *)icon;
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color normalIcon:(UIImage *)normalIcon selectedIcon:(UIImage *)selectedIcon;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface NSArray (SWUtilityButtons)
|
||||
|
||||
- (BOOL)sw_isEqualToButtons:(NSArray *)buttons;
|
||||
|
||||
@end
|
||||
92
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.m
vendored
Normal file
92
mobile/ios/ThirdParty/SWTableViewCell/PodFiles/NSMutableArray+SWUtilityButtons.m
vendored
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// NSMutableArray+SWUtilityButtons.m
|
||||
// SWTableViewCell
|
||||
//
|
||||
// Created by Matt Bowman on 11/27/13.
|
||||
// Copyright (c) 2013 Chris Wendel. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSMutableArray+SWUtilityButtons.h"
|
||||
|
||||
@implementation NSMutableArray (SWUtilityButtons)
|
||||
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color title:(NSString *)title
|
||||
{
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.backgroundColor = color;
|
||||
[button setTitle:title forState:UIControlStateNormal];
|
||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[button.titleLabel setAdjustsFontSizeToFitWidth:YES];
|
||||
[self addObject:button];
|
||||
}
|
||||
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color attributedTitle:(NSAttributedString *)title
|
||||
{
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.backgroundColor = color;
|
||||
[button setAttributedTitle:title forState:UIControlStateNormal];
|
||||
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[self addObject:button];
|
||||
}
|
||||
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color icon:(UIImage *)icon
|
||||
{
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.backgroundColor = color;
|
||||
[button setImage:icon forState:UIControlStateNormal];
|
||||
[self addObject:button];
|
||||
}
|
||||
|
||||
- (void)sw_addUtilityButtonWithColor:(UIColor *)color normalIcon:(UIImage *)normalIcon selectedIcon:(UIImage *)selectedIcon {
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
button.backgroundColor = color;
|
||||
[button setImage:normalIcon forState:UIControlStateNormal];
|
||||
[button setImage:selectedIcon forState:UIControlStateHighlighted];
|
||||
[button setImage:selectedIcon forState:UIControlStateSelected];
|
||||
[self addObject:button];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation NSArray (SWUtilityButtons)
|
||||
|
||||
- (BOOL)sw_isEqualToButtons:(NSArray *)buttons
|
||||
{
|
||||
buttons = [buttons copy];
|
||||
if (!buttons || self.count != buttons.count) return NO;
|
||||
|
||||
for (NSUInteger idx = 0; idx < self.count; idx++) {
|
||||
id buttonA = self[idx];
|
||||
id buttonB = buttons[idx];
|
||||
if (![buttonA isKindOfClass:[UIButton class]] || ![buttonB isKindOfClass:[UIButton class]]) return NO;
|
||||
if (![[self class] sw_button:buttonA isEqualToButton:buttonB]) return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
+ (BOOL)sw_button:(UIButton *)buttonA isEqualToButton:(UIButton *)buttonB
|
||||
{
|
||||
if (!buttonA || !buttonB) return NO;
|
||||
|
||||
UIColor *backgroundColorA = buttonA.backgroundColor;
|
||||
UIColor *backgroundColorB = buttonB.backgroundColor;
|
||||
BOOL haveEqualBackgroundColors = (!backgroundColorA && !backgroundColorB) || [backgroundColorA isEqual:backgroundColorB];
|
||||
|
||||
NSString *titleA = [buttonA titleForState:UIControlStateNormal];
|
||||
NSString *titleB = [buttonB titleForState:UIControlStateNormal];
|
||||
BOOL haveEqualTitles = (!titleA && !titleB) || [titleA isEqualToString:titleB];
|
||||
|
||||
UIImage *normalIconA = [buttonA imageForState:UIControlStateNormal];
|
||||
UIImage *normalIconB = [buttonB imageForState:UIControlStateNormal];
|
||||
BOOL haveEqualNormalIcons = (!normalIconA && !normalIconB) || [normalIconA isEqual:normalIconB];
|
||||
|
||||
UIImage *selectedIconA = [buttonA imageForState:UIControlStateSelected];
|
||||
UIImage *selectedIconB = [buttonB imageForState:UIControlStateSelected];
|
||||
BOOL haveEqualSelectedIcons = (!selectedIconA && !selectedIconB) || [selectedIconA isEqual:selectedIconB];
|
||||
|
||||
return haveEqualBackgroundColors && haveEqualTitles && haveEqualNormalIcons && haveEqualSelectedIcons;
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Add table
Add a link
Reference in a new issue