prajakta
prajakta

Reputation: 673

how to display UIActivityindicator in UITableView on iphone

i struggled almost 1 hour but i couldn't figure it out as how to display UIactivity indicator in UItableview as i cant use IB in UItableview(its not dragging) on iphone

i used this and its working but i want to display in viewDidload

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{

//loadingView =[LoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0]];//.window.subviews
    NSLog(@"dgdddddddddddddddddddd");
    UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(130, 10, 25, 25)];

    //UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 30.0, 320.0, 60.0)];
    activityView.center=customView.center;
    [activityView startAnimating];
    [ customView bringSubviewToFront:activityView];
    [customView addSubview:activityView];// [headerLabel release];

    return [customView autorelease];       
}

kindly suggest

Upvotes: 1

Views: 877

Answers (1)

Nareshkumar
Nareshkumar

Reputation: 2351

if the view attribute of the file is linked to the UITableView , then the subview will not be added. Try replacing the view attribute with a normal view which contains a table view and try adding the indicator. Also try to make the file owner class from uitableviewcontroller to uiviewcontroller class.

Upvotes: 2

Related Questions