Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-26-2011, 11:08 PM   #1 (permalink)
Beginner iOS Dev
 
Join Date: Feb 2011
Location: Boston
Posts: 372
cityofangels is on a distinguished road
Default Can't Get Rid Of UITableViewSeparator Lines

So I have a UITableView with a custom background and a grey UITableViewSeparatorColor. By default, my table shows separator lines even if there are no cells. I do not want this, I want it to be completely blank and only show separator lines between cells, but the background.

I got this working by using
Code:
 self.routineTableView.separatorColor = [UIColor grayColor];
when there are cells, the line shows just for those cells and not the background.

But when there are no cells (such as before a user adds cells), the lines are present.

I tried doing something like this:
Code:
    if ([[self.fetchedResultsController fetchedObjects] count] == 0)
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    else
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        self.routineTableView.separatorColor = [UIColor grayColor];
    }
but it just removes the line for the cells and the background.. Any ideas?

This pic shows that there are separator lines when the table is blank for all cells:


And this pic shows that when there are cells, the separator line is shown only for the cells, and not the background

Last edited by cityofangels; 05-26-2011 at 11:13 PM.
cityofangels is offline   Reply With Quote
Old 05-27-2011, 08:13 AM   #2 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,346
iSDK is on a distinguished road
Send a message via AIM to iSDK
Default

Code:
if ([[self.fetchedResultsController fetchedObjects] count] < 1)
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.routineTableView.separatorColor = [UIColor clearColor];
    }
    else
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        self.routineTableView.separatorColor = [UIColor grayColor];
    }
iSDK is offline   Reply With Quote
Old 05-27-2011, 12:28 PM   #3 (permalink)
Beginner iOS Dev
 
Join Date: Feb 2011
Location: Boston
Posts: 372
cityofangels is on a distinguished road
Default

Quote:
Originally Posted by iSDK View Post
Code:
if ([[self.fetchedResultsController fetchedObjects] count] < 1)
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.routineTableView.separatorColor = [UIColor clearColor];
    }
    else
    {
        self.routineTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
        self.routineTableView.separatorColor = [UIColor grayColor];
    }
Thanks, I tried this and it definitely helps.

One thing though, everything seems to work properly now but when I enter cells, the separator line does not show until I reload the view. Should I perhaps to [tableView reload] or something?
cityofangels is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 342
6 members and 336 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:12 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0