Skip to content
This repository was archived by the owner on Dec 27, 2025. It is now read-only.

Commit 9d6d8e0

Browse files
author
qiang.shen
committed
demo change
1 parent c903065 commit 9d6d8e0

8 files changed

Lines changed: 110 additions & 78 deletions

File tree

AspectsDemo/AspectsDemo.xcodeproj/project.pbxproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
1B504D661E5EE21A005F39BA /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1B504D651E5EE21A005F39BA /* Launch Screen.storyboard */; };
11+
1B504D681E5EE236005F39BA /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1B504D671E5EE236005F39BA /* Storyboard.storyboard */; };
1012
78573EF519155A2E000D3B00 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78573EF419155A2E000D3B00 /* Foundation.framework */; };
1113
78573EF719155A2E000D3B00 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78573EF619155A2E000D3B00 /* CoreGraphics.framework */; };
1214
78573EF919155A2E000D3B00 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78573EF819155A2E000D3B00 /* UIKit.framework */; };
@@ -21,7 +23,6 @@
2123
78573F1A19155A2E000D3B00 /* AspectsDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 78573F1919155A2E000D3B00 /* AspectsDemoTests.m */; };
2224
78573F2519155A74000D3B00 /* Aspects.m in Sources */ = {isa = PBXBuildFile; fileRef = 78573F2319155A74000D3B00 /* Aspects.m */; };
2325
78D7D77119177C8E002EB314 /* AspectsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 78D7D76F19177C8E002EB314 /* AspectsViewController.m */; };
24-
78D7D77219177C8E002EB314 /* AspectsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 78D7D77019177C8E002EB314 /* AspectsViewController.xib */; };
2526
/* End PBXBuildFile section */
2627

2728
/* Begin PBXContainerItemProxy section */
@@ -35,6 +36,8 @@
3536
/* End PBXContainerItemProxy section */
3637

3738
/* Begin PBXFileReference section */
39+
1B504D651E5EE21A005F39BA /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
40+
1B504D671E5EE236005F39BA /* Storyboard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = "<group>"; };
3841
78573EF119155A2E000D3B00 /* AspectsDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AspectsDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
3942
78573EF419155A2E000D3B00 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4043
78573EF619155A2E000D3B00 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -55,7 +58,6 @@
5558
78573F2419155A74000D3B00 /* Aspects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Aspects.h; path = ../../Aspects.h; sourceTree = "<group>"; };
5659
78D7D76E19177C8E002EB314 /* AspectsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AspectsViewController.h; sourceTree = "<group>"; };
5760
78D7D76F19177C8E002EB314 /* AspectsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AspectsViewController.m; sourceTree = "<group>"; };
58-
78D7D77019177C8E002EB314 /* AspectsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AspectsViewController.xib; sourceTree = "<group>"; };
5961
/* End PBXFileReference section */
6062

6163
/* Begin PBXFrameworksBuildPhase section */
@@ -123,7 +125,8 @@
123125
78573EFB19155A2E000D3B00 /* Supporting Files */,
124126
78D7D76E19177C8E002EB314 /* AspectsViewController.h */,
125127
78D7D76F19177C8E002EB314 /* AspectsViewController.m */,
126-
78D7D77019177C8E002EB314 /* AspectsViewController.xib */,
128+
1B504D651E5EE21A005F39BA /* Launch Screen.storyboard */,
129+
1B504D671E5EE236005F39BA /* Storyboard.storyboard */,
127130
);
128131
path = AspectsDemo;
129132
sourceTree = "<group>";
@@ -235,7 +238,8 @@
235238
files = (
236239
78573EFF19155A2E000D3B00 /* InfoPlist.strings in Resources */,
237240
78573F0719155A2E000D3B00 /* Images.xcassets in Resources */,
238-
78D7D77219177C8E002EB314 /* AspectsViewController.xib in Resources */,
241+
1B504D661E5EE21A005F39BA /* Launch Screen.storyboard in Resources */,
242+
1B504D681E5EE236005F39BA /* Storyboard.storyboard in Resources */,
239243
);
240244
runOnlyForDeploymentPostprocessing = 0;
241245
};
@@ -413,6 +417,7 @@
413417
GCC_PRECOMPILE_PREFIX_HEADER = YES;
414418
GCC_PREFIX_HEADER = "AspectsDemo/AspectsDemo-Prefix.pch";
415419
INFOPLIST_FILE = "AspectsDemo/AspectsDemo-Info.plist";
420+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
416421
PRODUCT_NAME = "$(TARGET_NAME)";
417422
WRAPPER_EXTENSION = app;
418423
};
@@ -426,6 +431,7 @@
426431
GCC_PRECOMPILE_PREFIX_HEADER = YES;
427432
GCC_PREFIX_HEADER = "AspectsDemo/AspectsDemo-Prefix.pch";
428433
INFOPLIST_FILE = "AspectsDemo/AspectsDemo-Info.plist";
434+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
429435
PRODUCT_NAME = "$(TARGET_NAME)";
430436
WRAPPER_EXTENSION = app;
431437
};

AspectsDemo/AspectsDemo/AspectsAppDelegate.m

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,15 @@
1313
@implementation AspectsAppDelegate
1414

1515
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
16-
AspectsViewController *aspectsController = [AspectsViewController new];
17-
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
18-
self.window.backgroundColor = [UIColor whiteColor];
19-
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:aspectsController];
20-
[self.window makeKeyAndVisible];
21-
22-
// Ignore hooks when we are testing.
23-
if (!NSClassFromString(@"XCTestCase")) {
24-
[aspectsController aspect_hookSelector:@selector(buttonPressed:) withOptions:0 usingBlock:^(id info, id sender) {
25-
NSLog(@"Button was pressed by: %@", sender);
26-
} error:NULL];
27-
28-
[aspectsController aspect_hookSelector:@selector(viewWillLayoutSubviews) withOptions:0 usingBlock:^{
29-
NSLog(@"Controller is layouting!");
30-
} error:NULL];
31-
}
32-
16+
[AspectsViewController aspect_hookSelector:@selector(viewDidLoad) withOptions:AspectPositionBefore usingBlock:^ {
17+
NSLog(@"viewDidLoad before");
18+
}error:nil];
19+
[AspectsViewController aspect_hookSelector:@selector(viewWillAppear:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo> aspectInfo,BOOL animated) {
20+
NSLog(@"viewWillAppear After");
21+
}error:nil];
22+
[AspectsViewController aspect_hookSelector:@selector(viewDidAppear:) withOptions:AspectPositionInstead usingBlock:^(id<AspectInfo> aspectInfo,BOOL animated) {
23+
NSLog(@"viewDidAppear Instead");
24+
}error:nil];
3325
return YES;
3426
}
3527

AspectsDemo/AspectsDemo/AspectsDemo-Info.plist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<string>1.0</string>
2525
<key>LSRequiresIPhoneOS</key>
2626
<true/>
27+
<key>UILaunchStoryboardName</key>
28+
<string>Launch Screen</string>
29+
<key>UIMainStoryboardFile</key>
30+
<string>Storyboard</string>
2731
<key>UIRequiredDeviceCapabilities</key>
2832
<array>
2933
<string>armv7</string>

AspectsDemo/AspectsDemo/AspectsViewController.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@
1010

1111
@interface AspectsViewController : UIViewController
1212

13-
- (IBAction)buttonPressed:(id)sender;
1413

1514
@end

AspectsDemo/AspectsDemo/AspectsViewController.m

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,18 @@
1111

1212
@implementation AspectsViewController
1313

14-
- (IBAction)buttonPressed:(id)sender {
15-
UIViewController *testController = [[UIImagePickerController alloc] init];
16-
17-
testController.modalPresentationStyle = UIModalPresentationFormSheet;
18-
[self presentViewController:testController animated:YES completion:NULL];
14+
- (void)viewDidLoad {
15+
[super viewDidLoad];
16+
17+
}
1918

20-
// We are interested in being notified when the controller is being dismissed.
21-
[testController aspect_hookSelector:@selector(viewWillDisappear:) withOptions:0 usingBlock:^(id<AspectInfo> info, BOOL animated) {
22-
UIViewController *controller = [info instance];
23-
if (controller.isBeingDismissed || controller.isMovingFromParentViewController) {
24-
[[[UIAlertView alloc] initWithTitle:@"Popped" message:@"Hello from Aspects" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"Ok", nil] show];
25-
}
26-
} error:NULL];
19+
- (void)viewWillAppear:(BOOL)animated {
20+
[super viewWillAppear:animated];
21+
}
2722

28-
// Hooking dealloc is delicate, only AspectPositionBefore will work here.
29-
[testController aspect_hookSelector:NSSelectorFromString(@"dealloc") withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> info) {
30-
NSLog(@"Controller is about to be deallocated: %@", [info instance]);
31-
} error:NULL];
23+
- (void)viewDidAppear:(BOOL)animated {
24+
[super viewDidAppear:animated];
3225
}
3326

27+
3428
@end

AspectsDemo/AspectsDemo/AspectsViewController.xib

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
3+
<dependencies>
4+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
5+
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
6+
</dependencies>
7+
<scenes>
8+
<!--View Controller-->
9+
<scene sceneID="EHf-IW-A2E">
10+
<objects>
11+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
14+
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
17+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<subviews>
20+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright © 2017年 PSPDFKit GmbH. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="obG-Y5-kRd">
21+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
22+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
23+
<nil key="highlightedColor"/>
24+
</label>
25+
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="AspectsDemo" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
26+
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
27+
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
28+
<nil key="highlightedColor"/>
29+
</label>
30+
</subviews>
31+
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
32+
<constraints>
33+
<constraint firstAttribute="centerX" secondItem="obG-Y5-kRd" secondAttribute="centerX" id="5cz-MP-9tL"/>
34+
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
35+
<constraint firstItem="obG-Y5-kRd" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="SfN-ll-jLj"/>
36+
<constraint firstAttribute="bottom" secondItem="obG-Y5-kRd" secondAttribute="bottom" constant="20" id="Y44-ml-fuU"/>
37+
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
38+
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="20" symbolic="YES" id="x7j-FC-K8j"/>
39+
</constraints>
40+
</view>
41+
</viewController>
42+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
43+
</objects>
44+
<point key="canvasLocation" x="53" y="375"/>
45+
</scene>
46+
</scenes>
47+
</document>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="ZSo-SG-jAR">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
6+
<dependencies>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
9+
</dependencies>
10+
<scenes>
11+
<!--Aspects View Controller-->
12+
<scene sceneID="zBa-jE-6Ia">
13+
<objects>
14+
<viewController id="ZSo-SG-jAR" customClass="AspectsViewController" sceneMemberID="viewController">
15+
<layoutGuides>
16+
<viewControllerLayoutGuide type="top" id="ehk-oV-DlG"/>
17+
<viewControllerLayoutGuide type="bottom" id="hdY-mX-Hjm"/>
18+
</layoutGuides>
19+
<view key="view" contentMode="scaleToFill" id="oFq-C9-eZX">
20+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
21+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
22+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
23+
</view>
24+
</viewController>
25+
<placeholder placeholderIdentifier="IBFirstResponder" id="CjV-Sq-Ug3" userLabel="First Responder" sceneMemberID="firstResponder"/>
26+
</objects>
27+
<point key="canvasLocation" x="-108" y="-123"/>
28+
</scene>
29+
</scenes>
30+
</document>

0 commit comments

Comments
 (0)