Coder Social home page Coder Social logo

Comments (11)

Kjuly avatar Kjuly commented on June 9, 2024

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];
  ...
}

from kycirclemenu.

AndrexOfficial avatar AndrexOfficial commented on June 9, 2024

Okay, but i can't assign a specific tag to that action
How can i fix it?

from kycirclemenu.

Kjuly avatar Kjuly commented on June 9, 2024

@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];

from kycirclemenu.

AndrexOfficial avatar AndrexOfficial commented on June 9, 2024

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?

from kycirclemenu.

Kjuly avatar Kjuly commented on June 9, 2024

// 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. :)

from kycirclemenu.

Kjuly avatar Kjuly commented on June 9, 2024

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.

from kycirclemenu.

AndrexOfficial avatar AndrexOfficial commented on June 9, 2024

No, it doesn't work:
here is my code

#import "AppDelegate.h"
#import "ADVTheme.h"
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
#import "GAI.h"
#import "KKPasscodeLock.h"
#import "KnobViewController.h"
#import "RadioViewController.h"
#import "Constants.h"

#define KY_CIRCLEMENU_WITH_NAVIGATIONBAR 1

/******* Set your tracking ID here *******/
static NSString *const kTrackingId = @"UA-TRACKING-ID";

@implementation AppDelegate

@synthesize window;
@synthesize rootController;
@synthesize nv1, nv2, nv3, nv4, nv5;

#pragma mark -
#pragma mark Application lifecycle

// method for startup splash screen animation

  • (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    [splashView removeFromSuperview];
    }

  • (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)applicationWillResignActive:(UIApplication )application {
    /

    Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    */
    }

  • (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];
    });
    

    }
    }

  • (void)shouldEraseApplicationData:(KKPasscodeViewController*)viewController
    {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"You have entered an incorrect passcode too many times. All account data in this app has been deleted." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    }

  • (void)didPasscodeEnteredIncorrectly:(KKPasscodeViewController*)viewController
    {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"You have entered an incorrect passcode too many times." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
    [alert show];
    }

  • (void)applicationDidBecomeActive:(UIApplication )application {
    /

    Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    */
    }

  • (void)applicationWillTerminate:(UIApplication )application {
    /

    Called when the application is about to terminate.
    See also applicationDidEnterBackground:.
    */
    }

#pragma mark -
#pragma mark Memory management

  • (void)applicationDidReceiveMemoryWarning:(UIApplication )application {
    /

    Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
    */
    }

@EnD

from kycirclemenu.

Kjuly avatar Kjuly commented on June 9, 2024

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.

from kycirclemenu.

ssaaaranraj avatar ssaaaranraj commented on June 9, 2024

how can i add images in the circle...

from kycirclemenu.

ssaaaranraj avatar ssaaaranraj commented on June 9, 2024

how can i add images in circle ( Kycircle menu)

from kycirclemenu.

Kjuly avatar Kjuly commented on June 9, 2024

@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 :)

from kycirclemenu.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.