Kjuly / KYCircleMenu

An iOS UI control that allows you to build a circular menu by laying out buttons in a circle pattern adjusting from the number of buttons (1~6).
MIT License
786 stars 154 forks source link

How To Call your viewcontroller from KYCircularMenu and Mantain your look and feel #3

Closed alexgsolutions closed 11 years ago

alexgsolutions commented 11 years ago

I downloaded de CirculesMenu and I successfully implement in my app but I am stock in how to show the other ViewControllers in my apps. I can call the other VC with these code

- (void)runButtonActions:(id)sender {
  [super runButtonActions:sender];

  if ([sender tag] == 1)
  {
    // Configure new view & push it with custom |pushViewController:| method
    MusicViewController *MviewController = [[MusicViewController alloc] init];
    //UIViewController * viewController = [[UIViewController alloc] init];
    //[viewController.view setBackgroundColor:[UIColor blackColor]];
    [MviewController setTitle:[NSString stringWithFormat:@"Música"]];
    // Use KYCircleMenu's |-pushViewController:| to push vc
    [self pushViewController:MviewController];
  }

My viewDidLoad code

- (void)viewDidLoad
{
  [super viewDidLoad];
  // Do any additional setup after loading the view.

  // Setting Up Activity Indicator View
  self.activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
  self.activityIndicatorView.hidesWhenStopped = YES;
  self.activityIndicatorView.center = self.view.center;
  [self.view addSubview:self.activityIndicatorView];
  [self.activityIndicatorView startAnimating];

  // Initializing Data Source
  NSURL *url = [NSURL URLWithString:StrJsonURL];
  NSURLRequest *request = [NSURLRequest requestWithURL:url];
  AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id getJSON) {
    _JSON = getJSON;
    [self.activityIndicatorView stopAnimating];
    NSLog(@"%@", _JSON);
    [self.tableView reloadData];
  } failure:nil];
  [operation start];
}

Not loadview code yet implemented

Kjuly commented 11 years ago

You need to implement -loadView like this if you don't use Xibs:

- (void)loadView {
  UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0.f, 0.f, kViewWidth, kViewHeight)];
  self.view = view;
  [view release];
}

Implement loadView to create a view hierarchy programmatically, without using a nib.