Skip to content
This repository was archived by the owner on Nov 2, 2020. It is now read-only.

Commit 137c021

Browse files
warplinggrp
authored andcommitted
Add an example for showing/dismissing the FBTweakViewController manually (#114)
* Add an example for showing/dismissing the FBTweakViewController manually * Clarify README instructions for manually presenting FBTweakViewController to reference an existing view controller rather than reaching out to a global one. * Fix typo
1 parent f65c346 commit 137c021

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,19 @@ To configure your tweaks, you need a way to show the configuration UI. There's t
9191
```
9292

9393
- You can present a `FBTweakViewController` from anywhere in your app. Be sure to restrict the activation UI to debug builds!
94-
94+
```objective-c
95+
- (void) showTweaks {
96+
FBTweakViewController *tweakVC = [[FBTweakViewController alloc] initWithStore:[FBTweakStore sharedInstance]];
97+
tweakVC.tweaksDelegate = self;
98+
// Assuming this is in the app delegate
99+
[self.window.rootViewController presentViewController:tweakVC animated:YES completion:nil];
100+
}
101+
102+
- (void) tweakViewControllerPressedDone:(FBTweakViewController *)tweakViewController {
103+
[tweakViewController dismissViewControllerAnimated:YES completion:NULL];
104+
}
105+
```
106+
95107
#### Tweaks UI Dismiss Notification
96108

97109
Alternatively, when the Tweaks UI is dismissed, you can register your notification center to listen to `FBTweakShakeViewControllerDidDismissNotification`, which can be used after importing `FBTweakViewController.h`

0 commit comments

Comments
 (0)