Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:53:54+00:00 2026-05-27T10:53:54+00:00

I have the following code to fetch the data from URL, store it in

  • 0

I have the following code to fetch the data from URL, store it in arrays, and display it inside the table.
I had some issue related to fetching and that is solved on SO Click here
Now the issue is data is displayed in the table in a manner which is not the ideal one.

When I run the below code, I get this output. That shaded grey portion is my main concern.
When I try to insert any element say button in that grey shaded area through design view, it gets overlapped by table.
If I change

aTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen]applicationFrame] style:UITableViewStyleGrouped];

with

aTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen]applicationFrame] style:UITableViewStylePlained];

I get the table output without the grey shadow but it’s way too simple.

Note that I’m creating table programmatically.

Screenshot
fetchdataViewController.h

#import <UIKit/UIKit.h>

@interface fetchdataViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>{
    IBOutlet UIWebView *webView;
    NSMutableArray *arr1;
    NSMutableArray *atarr;
    NSMutableArray *arr2;
    NSMutableArray *a;
    NSMutableArray *b;
    NSMutableArray *c;
    NSMutableArray *d;
    UITableView *aTableView;
}
-(IBAction)btnClicked:(id)sender;
-(IBAction)btnClicked1:(id)sender;
-(void)gainer;
-(void)looser;
@property(nonatomic,retain)NSMutableArray *arr1;
@property(nonatomic,retain)NSMutableArray *arr2;
@property(nonatomic,retain)NSMutableArray *atarr;
@property(nonatomic,retain)NSMutableArray *a;
@property(nonatomic,retain)NSMutableArray *b;
@property(nonatomic,retain)NSMutableArray *c;
@property(nonatomic,retain)NSMutableArray *d;
@property(nonatomic,retain)UIWebView *webView;
@property(nonatomic,retain)UITableView *aTableView;
@end

fetchdataViewController.m

#import "fetchdataViewController.h"

@implementation fetchdataViewController

NSMutableArray *atarr;
NSMutableArray *arr1;
NSMutableArray *arr2;
NSMutableArray *a;
NSMutableArray *b;
NSMutableArray *c;
NSMutableArray *d;
NSMutableString *mainstr;
NSMutableString *str;
@synthesize webView;
@synthesize arr1;
@synthesize arr2;
@synthesize atarr;
@synthesize a;
@synthesize b;
@synthesize c;
@synthesize d;
@synthesize aTableView;

int i,j;

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [a count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView 
         cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier=@"Cell"; 

    static NSInteger StateTag = 1;
    static NSInteger CapitalTag = 2;
    static NSInteger StateTag1 = 3;
    static NSInteger StateTag2 = 4;


    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell == nil){
        cell=[[[UITableViewCell alloc]initWithFrame:CGRectZero reuseIdentifier:CellIdentifier]autorelease];
        CGRect frame;
        frame.origin.x = 10; 
        frame.origin.y = 5;
        frame.size.height = 35;
        frame.size.width = 170;


        UILabel *capitalLabel = [[UILabel alloc] initWithFrame:frame];
        capitalLabel.tag = CapitalTag;
        [cell.contentView addSubview:capitalLabel];     

        frame.origin.x += 125;
        UILabel *stateLabel = [[UILabel alloc] initWithFrame:frame];
        stateLabel.tag = StateTag;
        [cell.contentView addSubview:stateLabel];

        frame.origin.x += 100;
        UILabel *stateLabel1 = [[UILabel alloc] initWithFrame:frame];
        stateLabel1.tag = StateTag1;
        [cell.contentView addSubview:stateLabel1];


        frame.origin.x += 100;
        UILabel *stateLabel2 = [[UILabel alloc] initWithFrame:frame];
        stateLabel2.tag = StateTag2;
        [cell.contentView addSubview:stateLabel2];


    }
    UILabel *capitalLabel = (UILabel *) [cell.contentView viewWithTag:CapitalTag];
    UILabel *stateLabel = (UILabel *) [cell.contentView viewWithTag:StateTag];
    UILabel *stateLabel1 = (UILabel *) [cell.contentView viewWithTag:StateTag1];
    UILabel *stateLabel2 = (UILabel *) [cell.contentView viewWithTag:StateTag2];

    capitalLabel.text=[a objectAtIndex:indexPath.row];
    stateLabel.text = [b objectAtIndex:indexPath.row];
    stateLabel1.text = [c objectAtIndex:indexPath.row];
    stateLabel2.text = [d objectAtIndex:indexPath.row];


    return cell;
}


-(IBAction)btnClicked:(id)sender{
    [self gainer];
}

-(IBAction)btnClicked1:(id)sender {

    [self looser];
}

-(void)gainer{
    arr1=[[NSMutableArray alloc]init];
    arr2=[[NSMutableArray alloc]init];
    a=[[NSMutableArray alloc]init];
    b=[[NSMutableArray alloc]init];
    c=[[NSMutableArray alloc]init];
    d=[[NSMutableArray alloc]init];

    NSURL *url=[NSURL URLWithString:@"http://ipad.idealake.com/default.aspx?id=G"];
    NSURLRequest *req=[NSURLRequest requestWithURL:url];
    [webView loadRequest:req];

    //storing page data in string
    mainstr=[[NSMutableString alloc] initWithContentsOfURL:url];
    atarr=[mainstr componentsSeparatedByString:@"@"];

    NSString *str2;
    NSString *str3;
    for(int i=0; i<[atarr count]-1; i++)
    {
        // NSLog(@"i=:%i",i); 

        NSMutableString *str = [atarr objectAtIndex:i];
        if (str!= nil)            
            arr1=[str componentsSeparatedByString:@";"];
            for (int k=0;k<[arr1 count];k++)
            {                
                str2 = [arr1 objectAtIndex:k];                
                [arr2 addObject:str2];
                            }


        }
        else
        {
            //NSLog (@"Nill");
        }

    }
    for(int l=0;l<[arr2 count]/4;l++){
        str3=[arr2 objectAtIndex:4*l];
        [a addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+1];
        [b addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+2];
        [c addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+3];
        [d addObject:str3];
    }    
}

-(void)looser{

    arr1=[[NSMutableArray alloc]init];
    arr2=[[NSMutableArray alloc]init];
    a=[[NSMutableArray alloc]init];
    b=[[NSMutableArray alloc]init];
    c=[[NSMutableArray alloc]init];
    d=[[NSMutableArray alloc]init];

    NSURL *url=[NSURL URLWithString:@"http://ipad.idealake.com/default.aspx?id=L"];
    NSURLRequest *req=[NSURLRequest requestWithURL:url];
    [webView loadRequest:req];

    mainstr=[[NSMutableString alloc] initWithContentsOfURL:url];
    atarr=[mainstr componentsSeparatedByString:@"@"];

    NSString *str2;
    NSString *str3;
    for(int i=0; i<[atarr count]-1; i++)
    {

        NSMutableString *str = [atarr objectAtIndex:i];
        if (str!= nil)
        {

            arr1=[str componentsSeparatedByString:@";"];
            for (int k=0;k<[arr1 count];k++)
            {

                str2 = [arr1 objectAtIndex:k];
                [arr2 addObject:str2];
            }          

        }
        else
        {
            //NSLog (@"Nill");
        }

    }
    for(int l=0;l<[arr2 count]/4;l++){
        str3=[arr2 objectAtIndex:4*l];
        [a addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+1];
        [b addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+2];
        [c addObject:str3];

        str3=[arr2 objectAtIndex:(4*l)+3];
        [d addObject:str3];
    }
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    arr1=[[NSMutableArray alloc]init];
    arr2=[[NSMutableArray alloc]init];
    a=[[NSMutableArray alloc]init];
    b=[[NSMutableArray alloc]init];
    c=[[NSMutableArray alloc]init];
    d=[[NSMutableArray alloc]init];

    [self gainer];
    [super viewDidLoad];

    aTableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen]applicationFrame] style:UITableViewStyleGrouped];
    aTableView.dataSource = self;
    aTableView.delegate = self;
    aTableView.frame = CGRectMake(0, 10, 720, 500);
    [self.view addSubview:aTableView];

    [super viewDidLoad];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

@end

THANKS IN ADVANCE

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:53:55+00:00Added an answer on May 27, 2026 at 10:53 am

    If your problem is to remove the lightgrey area from your groupedtableview, then you can remove the shaded grey area by adding this to your code:

    if ([myTable respondsToSelector:@selector(backgroundView)]) {
        myTable.backgroundView = nil;
    }
    

    It’s an issue that only iPad has with groupedTableViewStyle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to fetch the data from URL, store it in
I am trying to get data from a database. I have the following code
Hello I have the following code to retrieve data from my db using nhibernate
I have to display data from the database in a listview. I have fetch
I have to display data from the database in a listview. I have fetch
I have the following code $result = $handle->select()->from('store_details') ->where('store_details.store_id=?', $id) ->columns('store_details.store_name'); //->query(ZEND_DB::FETCH_OBJ); However, when
We have following code: try { // some code throwing MyException } catch (MyException
I'm using following code but cannot return data from MySQL. This is the output:
I have the following code in php: <?php $con = mysql_connect(localhost,john,john); mysql_select_db(data, $con); if
I have the following PHP code, which is meant to insert data in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.