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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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-12-2009, 11:47 PM   #1 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 15
Default a fixed background

i am having problems with my background image. How do i make it be a fixed background? Every time i scroll on the table the background image ends and then another image starts (same image of course) .. is there a way to make it so its just one fixed image? heres an example of my code

- (UIView *)tableViewUITableView *)tableView viewForHeaderInSectionNSInteger)section {

NSString *sectionName = nil;

switch (section) {
case 0:
sectionName = [NSString stringWithFormat:@"example"];
break;
case 1:
sectionName = [NSString stringWithFormat:@"example"];
break;
case 2:
sectionName = [NSString stringWithFormat:@"example"];
break;
}

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
sectionHeader.backgroundColor = [UIColor clearColor];
sectionHeader.font = [UIFont boldSystemFontOfSize:18];
sectionHeader.textColor = [UIColor whiteColor];
sectionHeader.text = sectionName;

return sectionHeader;
}


- (CGFloat)tableViewUITableView *)tableView heightForHeaderInSectionNSInteger)section
{
CGFloat height;
switch(section)
{
case 0:
{
height = 25.0;
}
break;
case 1:
{
height = 25.0;
}
break;
case 2:
{
height = 25.0;
}
break;
}
return height;
}


@end
B.Ice is offline   Reply With Quote
Old 05-12-2009, 11:58 PM   #2 (permalink)
Reena
 
Join Date: Apr 2009
Posts: 31
Default

Quote:
Originally Posted by B.Ice View Post
i am having problems with my background image. How do i make it be a fixed background? Every time i scroll on the table the background image ends and then another image starts (same image of course) .. is there a way to make it so its just one fixed image? heres an example of my code

- (UIView *)tableViewUITableView *)tableView viewForHeaderInSectionNSInteger)section {

NSString *sectionName = nil;

switch (section) {
case 0:
sectionName = [NSString stringWithFormat:@"example"];
break;
case 1:
sectionName = [NSString stringWithFormat:@"example"];
break;
case 2:
sectionName = [NSString stringWithFormat:@"example"];
break;
}

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
UILabel *sectionHeader = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 40)] autorelease];
sectionHeader.backgroundColor = [UIColor clearColor];
sectionHeader.font = [UIFont boldSystemFontOfSize:18];
sectionHeader.textColor = [UIColor whiteColor];
sectionHeader.text = sectionName;

return sectionHeader;
}


- (CGFloat)tableViewUITableView *)tableView heightForHeaderInSectionNSInteger)section
{
CGFloat height;
switch(section)
{
case 0:
{
height = 25.0;
}
break;
case 1:
{
height = 25.0;
}
break;
case 2:
{
height = 25.0;
}
break;
}
return height;
}


@end

try this,
set Uiimageview with your image on view
put uitableview on imageview
and create IBOUTLET of tableview
e.g.
IBOutlet UITableView *Tbl;

and clear the background color of tableview

- (void)viewDidLoad
{
[super viewDidLoad];
[Tbl setBackgroundColor:[UIColor clearColor]];
}

and set DataSource and Delegate of tableview
reena is offline   Reply With Quote
Old 05-13-2009, 12:08 AM   #3 (permalink)
New Member
 
Join Date: Apr 2009
Posts: 15
Default

Quote:
Originally Posted by reena View Post
try this,
set Uiimageview with your image on view
put uitableview on imageview
and create IBOUTLET of tableview
e.g.
IBOutlet UITableView *Tbl;

and clear the background color of tableview

- (void)viewDidLoad
{
[super viewDidLoad];
[Tbl setBackgroundColor:[UIColor clearColor]];
}

and set DataSource and Delegate of tableview
so do i need to actually build in interface builder? because my im using the background for my DataController.. the actual ViewController has the list then when clicked goes to the DataController and thats where i need the background so i cannot use Interface builder
B.Ice is offline   Reply With Quote
Reply

Bookmarks

Tags
background, color, fixed, image

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: 260
23 members and 237 guests
@sandris, ADY, Dani77, diyora, FAED, fredidf, F_Bryant, GHuebner, HDshot, iDifferent, JasonR, mer10, Oral B, prchn4christ, Rudy, Speed, spiderguy84, stekki, tgjorgoski, Thompson22, Touchmint, twerner, vigu360
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,753
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

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