This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SafariServices | |
class SafariWrapperViewController: UIViewController { | |
var safariViewController:SFSafariViewController? { | |
didSet(old) { | |
if old == self.safariViewController { | |
return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SafariServices | |
class SampleViewController: UIViewController, SFSafariViewControllerDelegate { | |
override func viewWillAppear(animated: Bool) { | |
super.viewWillAppear(animated) | |
self.navigationController?.navigationBar.alpha = 1.0 | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@property (nonatomic, weak) UIResponder *maybeFirstResponder; | |
// ... | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// UITextFieldTextDidBeginEditingNotificationを対象オブジェクトnilで監視 | |
[[NSNotificationCenter defaultCenter] addObserverForName:UITextFieldTextDidBeginEditingNotification object:nil queue:nil usingBlock:^(NSNotification *note) { | |
// イベント発生元オブジェクトを弱参照で保持しておく | |
self.maybeFirstResponder = note.object; |