Closed AndrexOfficial closed 11 years ago
Sorry for my late reply.
Just init your view controller, and KYCircleMenu has a instance method: -pushViewController:
, it'll manage the action of pushing view controller very well.
- (void)runButtonActions:(id)sender {
[super runButtonActions:sender];
// init your view controller with `-initWithNib:...` method
...
// push your view controller by `-pushViewController:`
[self.yourCircleMenu pushViewController:yourViewController];
...
}
Okay, but i can't assign a specific tag to that action How can i fix it?
@AndrexOfficial assign tag to your buttons, not view controller, if you need to modify the tag for the buttons, you can get the button by tag, then reassign the tag for it. :)
Let say you want to modify the 3rd button's tag:
UIButton * targetButton = (UIButton *)[self.yourCircleMenu viewWithTag:3];
[targetButton setTag:yourSpecificTag];
Okay, not I'm having another issue, I have a xib file called MainView and belongs to AppDelegate inside there is a tabbar controller with an array of views (nv1,nv2,nv3) but when i implement the KYCircle Menu and I launch the simulator I get a tabbar working but with a white view and no navigation bar (the navigation bar appears and then disappear very quickly) How can i manage this with your menu?
// The default case is that the navigation bar is only shown in child views. // If it is needed to be shown with the circle menu together, // just copy this macro into your own config file & comment it out. // // #define KY_CIRCLEMENU_WITH_NAVIGATIONBAR 1
So, put #define KY_CIRCLEMENU_WITH_NAVIGATIONBAR 1
at top of your class or anther other files that are compiled before your root view controller. If you are just using this lib, de-commentout this line is fine.
B.t.w, it is included in KYCircleMenu.h
.
Hope this'll helps. :)
And when you want to set the tab view controller as your root vc, you need to set the child view controllers for it. If the KYCircleMenu instance is one of your tab, don't forget to set it. I think that's why you got a white view.
No, it doesn't work: here is my code
/*** Set your tracking ID here ***/ static NSString *const kTrackingId = @"UA-TRACKING-ID";
@implementation AppDelegate
@synthesize window; @synthesize rootController; @synthesize nv1, nv2, nv3, nv4, nv5;
// method for startup splash screen animation
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
// Override point for customization after application launch. [self customizeGlobalTheme]; [ADVThemeManager customizeAppAppearance];
// Initialize Google Analytics with a 120-second dispatch interval. There is a // tradeoff between battery usage and timely dispatch. [GAI sharedInstance].debug = YES; [GAI sharedInstance].dispatchInterval = 120; [GAI sharedInstance].trackUncaughtExceptions = YES; self.tracker = [[GAI sharedInstance] trackerWithTrackingId:kTrackingId];
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch
// Navigation Controller UINavigationController * navigationController = [UINavigationController alloc];
// Circle Menu KnobViewController * circleMenuViewController; circleMenuViewController = [KnobViewController alloc]; // Set the cricle menu vc as the root vc [navigationController initWithRootViewController:circleMenuViewController]; [navigationController.navigationBar setBarStyle:UIBarStyleBlackTranslucent];
// Setup circle menu with basic configuration [circleMenuViewController initWithButtonCount:kKYCCircleMenuButtonsCount menuSize:kKYCircleMenuSize buttonSize:kKYCircleMenuButtonSize buttonImageNameFormat:kKYICircleMenuButtonImageNameFormat centerButtonSize:kKYCircleMenuCenterButtonSize centerButtonImageName:kKYICircleMenuCenterButton centerButtonBackgroundImageName:kKYICircleMenuCenterButtonBackground]; [circleMenuViewController release];
// Set navigation controller as the root vc [self.window setRootViewController:navigationController]; [navigationController release]; NSArray* controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nv4, nil]; rootController.viewControllers = controllers; [self.window addSubview:rootController.view]; [self.window makeKeyAndVisible];
/ NSArray\ controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nv4, nil]; rootController.viewControllers = controllers; [self.window addSubview:rootController.view]; [self.window makeKeyAndVisible];
*/ //Radio Background playing
NSError *sessionError = nil; [[AVAudioSession sharedInstance] setDelegate:self]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayAndRecord error:&sessionError];
/* Pick any one of them */ // 1. Overriding the output audio route //UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; //AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof(audioRouteOverride), &audioRouteOverride);
// 2. Changing the default output audio route UInt32 doChangeDefaultRoute = 1; AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, sizeof(doChangeDefaultRoute), &doChangeDefaultRoute);
////////
//Splashscreen animation splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)]; splashView.image = [UIImage imageNamed:@"Default.png"]; [window addSubview:splashView]; [window bringSubviewToFront:splashView]; [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:2.5]; [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES]; //animation transition effect [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; splashView.alpha = 0.0; splashView.frame = CGRectMake(-60, -85, 440, 635); [UIView commitAnimations];
[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav44_bg.png"] forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"nav44_bg.png"] forBarMetrics:UIBarMetricsLandscapePhone];
return YES; }
(void)customizeGlobalTheme { UIImage *barButton = [[UIImage imageNamed:@"Bar-Button-New.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
[[UIBarButtonItem appearance] setBackgroundImage:barButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
UIImage *backButton = [[UIImage imageNamed:@"Back-Button-New.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 14, 0, 4)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
UIImage* tabBarBackground = [UIImage imageNamed:@"TabBarBackground.png"]; [[UITabBar appearance] setBackgroundImage:tabBarBackground];
UIImage minImage = [[UIImage imageNamed:@"slider-fill"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 10, 0, 10)]; UIImage maxImage = [UIImage imageNamed:@"slider-track"]; UIImage *thumbImage = [UIImage imageNamed:@"slider-button"];
[[UISlider appearance] setMaximumTrackImage:maxImage forState:UIControlStateNormal]; [[UISlider appearance] setMinimumTrackImage:minImage forState:UIControlStateNormal]; [[UISlider appearance] setThumbImage:thumbImage forState:UIControlStateNormal];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
UIImage *image = [UIImage imageNamed:@"toolbar.png"]; [[UIToolbar appearance] setBackgroundImage:image forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
}
(void)applicationDidEnterBackground:(UIApplication *)application {
typedef enum { UIApplicationStateActive, UIApplicationStateInactive, UIApplicationStateBackground } UIApplicationState; / Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. / }
(void)applicationWillEnterForeground:(UIApplication )application { / Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background. / if ([[KKPasscodeLock sharedLock] isPasscodeRequired]) { KKPasscodeViewController vc = [[KKPasscodeViewController alloc] initWithNibName:nil bundle:nil]; vc.mode = KKPasscodeModeEnter; vc.delegate = self;
dispatch_async(dispatch_get_main_queue(),^ {
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
nav.modalPresentationStyle = UIModalPresentationFormSheet;
nav.navigationBar.barStyle = UIBarStyleBlack;
nav.navigationBar.opaque = NO;
} else {
nav.navigationBar.tintColor = nv1.navigationBar.tintColor;
nav.navigationBar.translucent = nv1.navigationBar.translucent;
nav.navigationBar.opaque = nv1.navigationBar.opaque;
nav.navigationBar.barStyle = nv1.navigationBar.barStyle;
}
[nv1 presentModalViewController:nav animated:YES];
});
} }
@end
I found that you tried to set a navigation controller (not a tab vc) as the root vc... Just take a try to remove
NSArray* controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nv4, nil];
rootController.viewControllers = controllers;
part in the code snippet below:
// Set navigation controller as the root vc
[self.window setRootViewController:navigationController];
[navigationController release];
NSArray* controllers = [NSArray arrayWithObjects:nv1, nv2, nv3, nv4, nil];
rootController.viewControllers = controllers;
[self.window addSubview:rootController.view];
[self.window makeKeyAndVisible];
And b.t.w, have you setup values for kKYCCircleMenuButtonsCount
, ...? As these are my demo constants.
how can i add images in the circle...
how can i add images in circle ( Kycircle menu)
@ssaaaranraj there's
#define kKYICircleMenuButtonImageNameFormat @"KYICircleMenuButton%.2d.png" // %.2d: 1 - 6
in demo project. And in this case, just provide KYICircleMenuButton01(@2x).png ... KYICircleMenuButton06(@2x).png.
u can provide ur own image name format (buttonImageNameFormat
) in init method
- (instancetype)initWithButtonCount:(NSInteger)buttonCount
menuSize:(CGFloat)menuSize
buttonSize:(CGFloat)buttonSize
buttonImageNameFormat:(NSString *)buttonImageNameFormat
centerButtonSize:(CGFloat)centerButtonSize
centerButtonImageName:(NSString *)centerButtonImageName
centerButtonBackgroundImageName:(NSString *)centerButtonBackgroundImageName;
Btw, plz open new issue next time, thx :)
Hi, how can I push a ViewController with a nib file and set its tag?
can you write down the code?
Thanks