Question

I am trying to add an UIActivityIndicatorView to UIActionsSheet in this way:

UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:nil
                                  delegate:sharedInstance
                                  cancelButtonTitle:nil
                                  destructiveButtonTitle:nil
                                  otherButtonTitles:nil];

for(NSMutableDictionary *dict in moreStructure)
   {
       NSString *value = [dict valueForKey:TITLE_PARAMETER];
       [actionSheet addButtonWithTitle:value];
   }
    [actionSheet addButtonWithTitle:@"Cancel"];
    actionSheet.cancelButtonIndex = [moreStructure count];
    [actionSheet showInView:((SectionViewController *)sharedInstance.currentViewController).view];
    UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    activityView.frame = CGRectMake(100, 500, 15, 15);
    [activityView startAnimating];
    [actionSheet addSubview:activityView];

When the UIActionSheet appears, however, I do not see an UIActivityIndicatorView on it. Please, help me.

Was it helpful?

Solution

I have try this and this is working... Please check frame of activityView... because its y is 500...

UIActionSheet *actionSheet = [[UIActionSheet alloc]
                                  initWithTitle:nil
                                  delegate:nil
                                  cancelButtonTitle:@"Test"
                                  destructiveButtonTitle:@"Test"
                                  otherButtonTitles:nil];

    [actionSheet showInView:self.view];

    UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    activityView.frame = CGRectMake(100, 5, 15, 15);
    [activityView startAnimating];
    [actionSheet addSubview:activityView];

    activityView.backgroundColor = [UIColor redColor];
    actionSheet.backgroundColor = [UIColor greenColor];

OTHER TIPS

activityView.frame = CGRectMake(100, 500, 15, 15);

// this so this above must change

activityView.frame = CGRectMake(10, 50, 300, 400);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top