forked from TKkk-iOSer/TKTweakDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTweak.xm
31 lines (26 loc) · 837 Bytes
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//
// Tweak.xm
// TKDemo
//
// Created by TK on 2017/3/18.
// Copyright © 2017年 TK. All rights reserved.
//
@interface MMUIViewController : UIViewController
- (void)helloWorld;
@end
%hook MMUIViewController
- (void)viewDidAppear:(_Bool)arg1 {
%orig;
[self helloWorld];
}
%new
- (void)helloWorld {
UIAlertController *alertController = ({
UIAlertController *al = [UIAlertController alertControllerWithTitle:@"hello World" message:nil preferredStyle:UIAlertControllerStyleAlert];
[al addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:nil]];
[al addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
al;
});
[self presentViewController:alertController animated:YES completion:nil];
}
%end