Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
UI7Switch partial implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed Jun 13, 2013
1 parent 76b3763 commit d9efab3
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 16 deletions.
6 changes: 6 additions & 0 deletions UI7Kit.xcodeproj/project.pbxproj
Expand Up @@ -38,6 +38,7 @@
38AF86CF1769BC8000BFBD29 /* libUI7Kit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38017423176989650049D26C /* libUI7Kit.a */; };
38BC0E5D173E821700F36497 /* UITSubviewTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 38BC0E5B173E821700F36497 /* UITSubviewTableViewController.m */; };
38EEF9C7176A366C0085B09B /* UI7Button.m in Sources */ = {isa = PBXBuildFile; fileRef = 38EEF9C6176A366C0085B09B /* UI7Button.m */; };
38EEF9CA176A482C0085B09B /* UI7Switch.m in Sources */ = {isa = PBXBuildFile; fileRef = 38EEF9C9176A482C0085B09B /* UI7Switch.m */; };
38F068181636F8C8002723AB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 383764E213373155007072FD /* UIKit.framework */; };
38F068191636F8C8002723AB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 383764D713373154007072FD /* Foundation.framework */; };
38F0681A1636F8C8002723AB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 383764E513373155007072FD /* CoreGraphics.framework */; };
Expand Down Expand Up @@ -131,6 +132,8 @@
38E58A901767576300F6ED19 /* UI7Kit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UI7Kit.h; sourceTree = "<group>"; };
38EEF9C5176A366C0085B09B /* UI7Button.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UI7Button.h; sourceTree = "<group>"; };
38EEF9C6176A366C0085B09B /* UI7Button.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UI7Button.m; sourceTree = "<group>"; };
38EEF9C8176A482C0085B09B /* UI7Switch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UI7Switch.h; sourceTree = "<group>"; };
38EEF9C9176A482C0085B09B /* UI7Switch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UI7Switch.m; sourceTree = "<group>"; };
38F068161636F8C8002723AB /* UI7KitTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UI7KitTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
38F0681D1636F8C8002723AB /* UI7KitTestApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UI7KitTestApp-Info.plist"; sourceTree = "<group>"; };
38F0681F1636F8C8002723AB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -304,6 +307,8 @@
382F54281767863B004D6F59 /* UI7TableView.m */,
38EEF9C5176A366C0085B09B /* UI7Button.h */,
38EEF9C6176A366C0085B09B /* UI7Button.m */,
38EEF9C8176A482C0085B09B /* UI7Switch.h */,
38EEF9C9176A482C0085B09B /* UI7Switch.m */,
380174601769FE390049D26C /* Resources */,
38017426176989660049D26C /* Supporting Files */,
);
Expand Down Expand Up @@ -517,6 +522,7 @@
38EEF9C7176A366C0085B09B /* UI7Button.m in Sources */,
3801744F176989B80049D26C /* UI7Kit.m in Sources */,
38017450176989B80049D26C /* UI7Utilities.m in Sources */,
38EEF9CA176A482C0085B09B /* UI7Switch.m in Sources */,
38017451176989B80049D26C /* UI7NavigationBar.m in Sources */,
38017452176989B80049D26C /* UI7Toolbar.m in Sources */,
38017453176989B80049D26C /* UI7BarButtonItem.m in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion UI7Kit/UI7Button.h
Expand Up @@ -3,7 +3,7 @@
// UI7Kit
//
// Created by Jeong YunWon on 13. 6. 14..
// Copyright (c) 2013년 youknowone.org. All rights reserved.
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#include <UI7Kit/UI7Utilities.h>
Expand Down
2 changes: 1 addition & 1 deletion UI7Kit/UI7Button.m
Expand Up @@ -3,7 +3,7 @@
// UI7Kit
//
// Created by Jeong YunWon on 13. 6. 14..
// Copyright (c) 2013년 youknowone.org. All rights reserved.
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import "UI7Button.h"
Expand Down
3 changes: 2 additions & 1 deletion UI7Kit/UI7Kit.m
Expand Up @@ -3,7 +3,7 @@
// UI7Kit
//
// Created by Jeong YunWon on 13. 6. 13..
// Copyright (c) 2013년 youknowone.org. All rights reserved.
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import "UI7Kit.h"
Expand All @@ -18,6 +18,7 @@ void UI7KitPatchAll(BOOL override7) {
@"UI7NavigationBar",
@"UI7NavigationController",
@"UI7Button",
@"UI7Switch",
]) {
Class class = NSClassFromString(className);
[class patch];
Expand Down
13 changes: 13 additions & 0 deletions UI7Kit/UI7Switch.h
@@ -0,0 +1,13 @@
//
// UI7Switch.h
// UI7Kit
//
// Created by Jeong YunWon on 13. 6. 14..
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import <UI7Kit/UI7Utilities.h>

@interface UI7Switch : UISwitch<UI7Patch>

@end
61 changes: 61 additions & 0 deletions UI7Kit/UI7Switch.m
@@ -0,0 +1,61 @@
//
// UI7Switch.m
// UI7Kit
//
// Created by Jeong YunWon on 13. 6. 14..
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import "UI7Switch.h"

@implementation UISwitch (Patch)

- (id)__initWithCoder:(NSCoder *)aDecoder { assert(NO); return nil; }
- (id)__initWithFrame:(CGRect)frame { assert(NO); return nil; }

- (void)_switchInit {
self.onTintColor = [UIColor colorWith8bitRed:76 green:217 blue:100 alpha:255];
if ([self respondsToSelector:@selector(onImage)]) {
self.onImage = [UIImage blankImage];
self.offImage = [UIImage blankImage];
}
}

@end

@implementation UI7Switch

+ (void)initialize {
if (self == [UI7Switch class]) {
NSAClass *class = [NSAClass classWithClass:[UISwitch class]];
[class copyToSelector:@selector(__initWithCoder:) fromSelector:@selector(initWithCoder:)];
[class copyToSelector:@selector(__initWithFrame:) fromSelector:@selector(initWithFrame:)];
}
}

+ (void)patch {
NSAClass *sourceClass = [NSAClass classWithClass:[self class]];
Class targetClass = [UISwitch class];

[sourceClass exportSelector:@selector(initWithCoder:) toClass:targetClass];
[sourceClass exportSelector:@selector(initWithFrame:) toClass:targetClass];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super __initWithCoder:aDecoder];
if (self != nil) {
[self _switchInit];
}
return self;
}

- (id)initWithFrame:(CGRect)frame
{
self = [self __initWithFrame:frame];
if (self != nil) {
[self _switchInit];
}
return self;
}

@end
8 changes: 4 additions & 4 deletions UI7Kit/UI7TableView.m
Expand Up @@ -38,10 +38,10 @@ + (void)initialize {

+ (void)patch {
NSAClass *sourceClass = [NSAClass classWithClass:[self class]];

[sourceClass exportSelector:@selector(initWithCoder:) toClass:[UITableView class]];
[sourceClass exportSelector:@selector(initWithFrame:) toClass:[UITableView class]];
[sourceClass exportSelector:@selector(setDelegate:) toClass:[UITableView class]];
Class targetClass = [UITableView class];
[sourceClass exportSelector:@selector(initWithCoder:) toClass:targetClass];
[sourceClass exportSelector:@selector(initWithFrame:) toClass:targetClass];
[sourceClass exportSelector:@selector(setDelegate:) toClass:targetClass];
}

- (id)initWithCoder:(NSCoder *)aDecoder {
Expand Down
35 changes: 28 additions & 7 deletions UI7KitTestApp/Storyboard.storyboard
@@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="4457.6" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" variant="6xAndEarlier" propertyAccessControl="none" initialViewController="r1d-64-0wN">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="2.0" toolsVersion="3084" systemVersion="12E55" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" initialViewController="r1d-64-0wN">
<dependencies>
<deployment defaultVersion="1280" identifier="iOS"/>
<deployment defaultVersion="1552" identifier="iOS"/>
<development version="4600" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3682.6"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="2083"/>
</dependencies>
<scenes>
<!--Navigation Controller-->
<scene sceneID="S5g-Tb-iC2">
<objects>
<navigationController definesPresentationContext="YES" id="r1d-64-0wN" sceneMemberID="viewController">
<extendedEdge key="edgesForExtendedLayout"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="hOx-dN-vyL">
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
Expand Down Expand Up @@ -85,7 +84,6 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<navigationItem key="navigationItem" title="List" id="HIG-nr-RKe"/>
<connections>
<outlet property="listTableView" destination="ciM-Me-ZX6" id="G3B-tZ-ela"/>
Expand Down Expand Up @@ -128,7 +126,6 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<toolbarItems/>
<navigationItem key="navigationItem" title="Text" id="sET-y7-ILT">
<barButtonItem key="rightBarButtonItem" style="plain" id="QEK-hF-05Y">
Expand Down Expand Up @@ -184,14 +181,38 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<extendedEdge key="edgesForExtendedLayout"/>
<navigationItem key="navigationItem" title="Detail" id="VmR-2N-0ni"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="EoT-Ud-iQ4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="843" y="-596"/>
</scene>
</scenes>
<classes>
<class className="UIAPlaceholderTextView" superclassName="UITextView">
<source key="sourceIdentifier" type="project" relativePath="./Classes/UIAPlaceholderTextView.h"/>
</class>
<class className="UITDetailViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/UITDetailViewController.h"/>
<relationships>
<relationship kind="outlet" name="detailDescriptionLabel" candidateClass="UILabel"/>
</relationships>
</class>
<class className="UITMasterViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/UITMasterViewController.h"/>
<relationships>
<relationship kind="outlet" name="listTableView" candidateClass="UITableView"/>
</relationships>
</class>
<class className="UITTextViewController" superclassName="UIViewController">
<source key="sourceIdentifier" type="project" relativePath="./Classes/UITTextViewController.h"/>
<relationships>
<relationship kind="action" name="resign:"/>
<relationship kind="action" name="switched:"/>
<relationship kind="outlet" name="textView" candidateClass="UIAPlaceholderTextView"/>
</relationships>
</class>
</classes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
Expand Down
2 changes: 1 addition & 1 deletion UI7KitTests/UI7KitTests.h
Expand Up @@ -3,7 +3,7 @@
// UI7KitTests
//
// Created by Jeong YunWon on 13. 6. 13..
// Copyright (c) 2013년 youknowone.org. All rights reserved.
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import <SenTestingKit/SenTestingKit.h>
Expand Down
2 changes: 1 addition & 1 deletion UI7KitTests/UI7KitTests.m
Expand Up @@ -3,7 +3,7 @@
// UI7KitTests
//
// Created by Jeong YunWon on 13. 6. 13..
// Copyright (c) 2013년 youknowone.org. All rights reserved.
// Copyright (c) 2013 youknowone.org. All rights reserved.
//

#import "UI7KitTests.h"
Expand Down

0 comments on commit d9efab3

Please sign in to comment.