Remove top shadow in my group UITableView?

I'm a little OCD and it drives me crazy. I have been communicating with these settings for a long time.

I have a UITableView grouped, I have a shadow on top. When you click on the top cell, it is deleted. What gives?

I have emphasized this for the past hour or so. Is there a simple solution for this? Or am I just losing my mind?

Thanks Coulton

enter image description here

EDIT:

viewDidLoad:

formTableView.backgroundColor = [UIColor clearColor];
formTableView.layer.borderColor = [UIColor clearColor].CGColor;
formTableView.separatorColor = [UIColor colorWithRed:(194.0 / 255.0) green:(194.0 / 255.0) blue:(194.0 / 255.0) alpha: 1];

This is how I display my cells. WARNING: Lots of code. There are a bunch of things that you have to make your way around, so try it at your own peril and risk! :)

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {

}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 2;
}


- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}

// What to do when you click delete.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}

//RootViewController.m
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

if (section == 0) {
    return [formDataOne count];
} else {
    return [formDataTwo count];
}
}

//RootViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {



static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}

for (UIView *subview in [cell.contentView subviews]) {
    [subview removeFromSuperview];
}

// Set up the cell...
NSString *cellValue;
if (indexPath.section == 0) {
    cellValue = [formDataOne objectAtIndex:indexPath.row];
} else {
    cellValue = [formDataTwo objectAtIndex:indexPath.row];
}


if (indexPath.section == 0) {
    cell.text = @"";
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    if (indexPath.row == 0) {
        addTitle = [[UITextField alloc] initWithFrame:CGRectMake(13, 13, 280, 20)];
        addTitle.borderStyle = UITextBorderStyleNone;
        addTitle.textColor = [UIColor blackColor]; //text color
        addTitle.font = [UIFont systemFontOfSize:16.0];  //font size
        addTitle.placeholder = @"Album Name";  //place holder
        addTitle.backgroundColor = [UIColor clearColor]; //background color
        addTitle.autocorrectionType = UITextAutocorrectionTypeNo;   // no auto correction support
        addTitle.keyboardType = UIKeyboardTypeDefault;  // type of the keyboard
        addTitle.returnKeyType = UIReturnKeyDone;  // type of the return key
        addTitle.clearButtonMode = UITextFieldViewModeWhileEditing; // has a clear 'x' button to the right
        addTitle.delegate = self;   // let us be the delegate so we know when the keyboard "Done" button is pressed
        [cell.contentView addSubview:addTitle];
    } else if (indexPath.row == 1) {
        // Set up loading text and show it
        UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(13, 13, 280, 20)];
        myLabel.text = @"Private Album";
        myLabel.textColor = [UIColor blackColor];
        myLabel.textAlignment = UITextAlignmentLeft;
        myLabel.backgroundColor = [UIColor clearColor];
        myLabel.font = [UIFont fontWithName:@"Helvetica" size: 16.0];
        myLabel.numberOfLines = 0;
        //[myLabel sizeToFit];


        privateSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(199, 8, 0, 0)];
        [privateSwitch addTarget:self action:@selector(switchToggled:) forControlEvents: UIControlEventTouchUpInside];
        [cell.contentView addSubview:privateSwitch];
        //[privateSwitch setOn:NO animated:NO];

        if ([howToDisplay isEqualToString:@"no"]) {
            [privateSwitch setOn:NO animated:NO];
        } else {
            [privateSwitch setOn:YES animated:NO];
        }



        [cell.contentView addSubview:myLabel];
    } else {
        // Set up loading text and show it
        UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(13, 13, 280, 20)];
        myLabel.text = @"Comments";
        myLabel.textColor = [UIColor blackColor];
        myLabel.textAlignment = UITextAlignmentLeft;
        myLabel.backgroundColor = [UIColor clearColor];
        myLabel.font = [UIFont fontWithName:@"Helvetica" size: 16.0];
        myLabel.numberOfLines = 0;
        //[myLabel sizeToFit];
        [cell.contentView addSubview:myLabel];

        commentsSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(199, 8, 0, 0)];
        [cell.contentView addSubview:commentsSwitch];
        [commentsSwitch setOn:YES animated:NO];
    }

} else {
    //cell.text = cellValue;

    UILabel *labelOne = [[UILabel alloc] initWithFrame:CGRectMake(48, 12, 130, 20)];
    labelOne.text = cellValue;
    labelOne.textColor = [UIColor blackColor];
    [labelOne setFont:[UIFont boldSystemFontOfSize:16]];
    labelOne.textAlignment = UITextAlignmentLeft;
    labelOne.backgroundColor = [UIColor clearColor];
    //labelOne.font = [UIFont fontWithName:@"Helvetica"];
    labelOne.numberOfLines = 0;
    [cell.contentView addSubview:labelOne];



    if (indexPath.row == 0) {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    } else if (indexPath.row == 1) {
        int countFacebook = [dataCeter.connectionFacebookArray count];
        if (countFacebook == 0) {
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        } else {
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
    }  else if (indexPath.row == 2) {

    //}  else if (indexPath.row == 3) {

    }  else if (indexPath.row == 3) {
        int countTumblr = [dataCeter.connectionTumblrArray count];
        if (countTumblr == 0) {
            cell.selectionStyle = UITableViewCellSelectionStyleBlue;
        } else {
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
        }
    }  else if (indexPath.row == 4) {

    }  else if (indexPath.row == 5) {

    } else {
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    }

}

// Set imageView with correct thumbnail
UIImage *theImage;
if ([cellValue isEqualToString:@"Facebook"]) {

    theImage = [UIImage imageNamed:@"icon_small_facebook.png"];
    int countFacebook = [dataCeter.connectionFacebookArray count];
    NSLog(@"facebook? %d // %@", countFacebook, dataCeter.connectionFacebookArray);

    if (countFacebook != 0) {
        facebookSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(199, 8, 0, 0)];
        [cell.contentView addSubview:facebookSwitch];
        [facebookSwitch setOn:YES animated:NO];
        cell.accessoryType = UITableViewCellAccessoryNone;
    } else {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

} else if ([cellValue isEqualToString:@"Twitter"]) {

    theImage = [UIImage imageNamed:@"icon_small_twitter.png"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

} else if ([cellValue isEqualToString:@"Flickr"]) {

    theImage = [UIImage imageNamed:@"icon_small_flickr.png"];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

} else if ([cellValue isEqualToString:@"Tumblr"]) {

    theImage = [UIImage imageNamed:@"icon_small_tumblr.png"];
    int countTumblr = [dataCeter.connectionTumblrArray count];

    if (countTumblr != 0) {
        tumblrSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(199, 8, 0, 0)];
        [cell.contentView addSubview:tumblrSwitch];
        [tumblrSwitch setOn:YES animated:NO];
        cell.accessoryType = UITableViewCellAccessoryNone;
    } else {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }

} else if ([cellValue isEqualToString:@"Email"]) {

    theImage = [UIImage imageNamed:@"icon_small_email.png"];
    int countEmail = [dataCeter.connectionEmailArray count];

} else if ([cellValue isEqualToString:@"MMS"]) {

    theImage = [UIImage imageNamed:@"icon_small_mms.png"];
    int countMMS = [dataCeter.connectionSMSArray count];

} else if ([cellValue isEqualToString:@"Photostream"]) {

    theImage = [UIImage imageNamed:@"icon_small_photostream.png"];
    cell.accessoryType = UITableViewCellAccessoryNone;
    photostreamSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(199, 8, 0, 0)];
    [cell.contentView addSubview:photostreamSwitch];
    [photostreamSwitch setOn:YES animated:NO];

} else {

    theImage = nil;
    cell.accessoryType = UITableViewCellAccessoryNone;

}
cell.imageView.image = theImage;

    return cell;
}
+3
source share
2 answers

UITableViewCellSeparatorStyleSingleLine. UITableViewCellSeparatorStyleSingleLineEtched, iPhone ( iOS 5 iOS 3.2 4 iPad).

+8

, , .

" " , . , " " .

, , , .

+1

All Articles