精省錢 將字串複製到記憶體筆記

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
32
33
34
35
36
37
38
39
40
41
42
43
44
if ([host isEqualToString:@"mympro_Copy"]) {
    NSString *command = request.URL.path.lastPathComponent;
    if ([command isEqualToString:@"mobileNumber"]) {
        NSString *mobileNumber = [[NSUserDefaults standardUserDefaults] stringForKey:@"mobileNumber"];
        if (mobileNumber.length != 0) {
            [UIPasteboard generalPasteboard].string = mobileNumber;
            [labelStatus setText:@"門號已複製到記憶體..."];
        } else {
            [labelStatus setText:@"尚未設定門號..."];
        }
    }
    if ([command isEqualToString:@"mobilePasswd"]) {
        NSString *mobilePasswd = [[NSUserDefaults standardUserDefaults] stringForKey:@"mobilePasswd"];
        if (mobilePasswd.length != 0) {
            [UIPasteboard generalPasteboard].string = mobilePasswd;
            [labelStatus setText:@"密碼已複製到記憶體..."];
        } else {
            [labelStatus setText:@"尚未設定密碼..."];
        }
    }
    return NO;
}
 
- (IBAction)btnNumberClicked:(id)sender {
	NSString *mobileNumber = [[NSUserDefaults standardUserDefaults] stringForKey:@"mobileNumber"];
 
	if (mobileNumber.length != 0) {
		[UIPasteboard generalPasteboard].string = mobileNumber;
		[labelStatus setText:@"門號已複製到記憶體..."];
	} else {
		[labelStatus setText:@"尚未設定門號..."];
	}
}
 
- (IBAction)btnPasswdClicked:(id)sender {
	NSString *mobilePasswd = [[NSUserDefaults standardUserDefaults] stringForKey:@"mobilePasswd"];
 
	if (mobilePasswd.length != 0) {
		[UIPasteboard generalPasteboard].string = mobilePasswd;
		[labelStatus setText:@"密碼已複製到記憶體..."];
	} else {
		[labelStatus setText:@"尚未設定密碼..."];
	}
}

Comments are closed.