PSUIKit 1.0.2

PSUIKit 1.0.2

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布最后发布2016 年 8 月

pisces 维护。



 
依赖于
SDWebImage>= 0
Reachability>= 0
OHAttributedLabel>= 0
UIViewControllerTransitions>= 0
 

PSUIKit 1.0.2

  • 作者
  • pisces

PSUIKit 是一个框架,可以帮助您轻松创建 iOS 应用程序并更改设计风格。它拥有许多有用的组件和类。

功能

  • 提供了一种创建自定义组件的简单方法
  • 主题提供导航栏,帮助您轻松更改样式
  • 应用程序中提供常用组件

演示应用程序

示例

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install

使用主题更改导航栏样式

  • 使用全局主题实现应用程序
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [UIApplication sharedApplication].theme = [[UIThemeDefaultStyle alloc] init];

    return YES;
}
  • 使用实例主题实现应用程序
UIViewController *controller = [[UIViewController alloc] init];

UINavigationController *navigationController = [[PSNavigationController alloc] initWithRootViewController:controller];
navigationController.theme = [[UIThemeDefaultStyle alloc] init];

[self presentViewController:navigationController animated:NO completion:nil];
  • 实现自定义主题
#import "CustomTheme.h"

@implementation CustomTheme

- (UIColor *)navigationBarBarTintColor {
    return [UIColor brownColor];
}

- (UIColor *)navigationBarTintColor {
    return [UIColor yellowColor];
}

- (NSDictionary *)navigationBarTitleTextAttributes {
    return @{UITextAttributeFont: [UIFont boldSystemFontOfSize:18], UITextAttributeTextColor: [UIColor blackColor]};
}

@end

使用 PSUIKit 实现自定义组件

使用 PSUIKit 的有价值的组件

PSAlertView

设计上,如 UIAlertView 帮助将不同视图放在内部。

- (void)testPSAlertView {
    [PSAlertView alertViewWithTitle:@"Title Sample" message:@"Message Sample!!" cancelButtonTitle:@"ok" dismission:nil otherButtonTitles:nil, nil];
}

- (void)testPSAlertViewWithCustomContentView {
    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 100)];
    tableView.dataSource = self;
    tableView.delegate = self;

    [PSAlertView alertViewWithContentView:tableView cancelButtonTitle:@"ok" dismission:nil otherButtonTitles:nil, nil];
}
PSAttributedDivisionLabel

具有各种字体样式的标签

- (void)testPSAttributedDivisionLabel {
    PSAttributedDivisionLabel *label = [[PSAttributedDivisionLabel alloc] init];
    label.divider = @"\n";
    label.colors = @[[UIColor redColor], [UIColor blueColor], [UIColor greenColor]];
    label.fonts = @[[UIFont systemFontOfSize:12], [UIFont systemFontOfSize:14], [UIFont systemFontOfSize:16]];
    label.text = @"redColor\nblueColor\ngreenColor";

    [self.view addSubview:label];
    [label sizeToFit];
}
PSBadge

可以应用于图像背景的徽章

- (void)testPSBadge {
    UIView *sourceView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 28, 28)];
    sourceView.layer.cornerRadius = sourceView.width/2;
    sourceView.backgroundColor = [UIColor redColor];

    PSBadge *badge = [[PSBadge alloc] initWithBackgroundImage:sourceView.image maxSize:CGSizeMake(100, sourceView.height) minSize:sourceView.size padding:CGPaddingMake(3, 3, 3, 3)];
    badge.text = @"7";
    badge.textLabel.textColor = [UIColor whiteColor];
    badge.origin = CGPointMake(self.xOffset, self.yOffset);

    [self.view addSubview:badge];
}
PSButtonBar

- (void)testPSButtonBar {
    PSButtonBar *buttonBar = [[PSButtonBar alloc] initWithFrame:CGRectMake(0, self.yOffset, self.view.width, 60)];
    buttonBar.numOfButtons = 3;
    buttonBar.seperatorColor = [UIColor whiteColor];

    buttonBar.delegateObject = [[PSButtonBarDelegateObject alloc] initWithRender:^(UIButton *button, NSUInteger buttonIndex) {
        [button setBackgroundImage:[[UIView alloc] initWithColor:[UIColor lightGrayColor] withFrame:button.bounds].image forState:UIControlStateNormal];
        [button setTitle:[NSString stringWithFormat:@"Button%tu", (buttonIndex+1)] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    } clicked:^(UIButton *button, NSUInteger buttonIndex) {
        NSLog(@"buttonBar clicked: buttonIndex -> %tu", buttonIndex);
    } resized:^(UIButton *button, NSUInteger buttonIndex) {
        NSLog(@"buttonBar resized: buttonIndex -> %tu", buttonIndex);
    } selected:^(UIButton *button, NSUInteger buttonIndex) {
        NSLog(@"buttonBar selected: buttonIndex -> %tu", buttonIndex);
    }];

    [self.view addSubview:buttonBar];
} 
PSPreloader

- (void)testPSPreloader {
    [[PSPreloader sharedInstance] show];

    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [[PSPreloader sharedInstance] hideWithStatus:PSPreloaderStatusCompletion completion:nil];
    });
}
PSToastView

- (void)testPSToastView {
    PSToastView *toastView = [[PSToastView alloc] init];

    [toastView showInView:self.view message:@"Toast Sample Message!!"];
}
PSGridView
PSLinedBackgroundView

需求

iOS部署目标7.0及以上

安装

PSUIKit可通过CocoaPods获得。要安装它,只需将以下行添加到Podfile中

pod "PSUIKit"

展示

Golfzon应用

Orcller应用

作者

Steve Kim, [email protected]

许可

PSUIKit在MIT许可下可用。有关更多信息,请参阅LICENSE文件。