Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

SmartiOS

macrumors newbie
Original poster
Jul 13, 2012
18
0
Hi, i'm trying to create a view from code for DetailViewController without using storyboard. so i just need some help here i don't know how it work :confused:

Code:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

{ 
DetailViewController *detail = [[DetailViewController alloc] init];
[COLOR="Lime"]// change detailview background color___Changed..OK! //[/COLOR]
detail.view.backgroundColor = [UIColor whiteColor];
[COLOR="Lime"] // here i want make uiimage?....doesn't work! //[/COLOR]
detail.image = UIImage imageNamed:@"cover.png"];
[COLOR="Lime"] // here i want make UIButton ?....doesn't work///[/COLOR]
frame = CGRectMake(10, 70, 300, 50); or UIButton something like this...

[COLOR="Lime"] // make Descriptiontext //[/COLOR]
...................??

[self.navigationController pushViewController:detail animated:YES];
}
 	
-	@end

Thanks for any help.
 
Last edited by a moderator:

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
Your actual code would be helpful... It's difficult to help you given what you've posted won't even compile.

What is DetailViewController? What does setting its image property do? What should it do?

Have you been remembering to add the UI components you create as subviews? They won't appear until you do...
 

SmartiOS

macrumors newbie
Original poster
Jul 13, 2012
18
0
Well, impressive! you don't know what it's DetailViewController? so when you create a push detailsView you will know what's detailviewcontroller, this is one.

two... i actually want to push different deatilview from selected row and already i did it, but when i access to detailview the background is empty and white screen because i don't use nib file or storyboard.

once you see that is too difficult, suggest me to a simple method.

thanks anyway.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,558
6,058
I just double checked, just to be certain. There is definitely not a built in class called DetailViewController. I therefor conclude that it's a class you wrote yourself but didn't share the implementation of. Since you didn't tell us, I have to guess its a subclass of UIViewController. UIViewController doesn't have a property called image. Thus you're either not using a UIViewController as your base class, or you've created a custom property called image.

No matter how I look at this, you haven't shared enough details about what you are doing. I offered a friendly reminder about what you definitely need to be doing.

Thanks for the attitude, though. I'm sure everyone online loves helping people with attitude.
 

waterskier2007

macrumors 68000
Jun 19, 2007
1,871
228
Novi, MI
I just double checked, just to be certain. There is definitely not a built in class called DetailViewController. I therefor conclude that it's a class you wrote yourself but didn't share the implementation of. Since you didn't tell us, I have to guess its a subclass of UIViewController. UIViewController doesn't have a property called image. Thus you're either not using a UIViewController as your base class, or you've created a custom property called image.

No matter how I look at this, you haven't shared enough details about what you are doing. I offered a friendly reminder about what you definitely need to be doing.

Thanks for the attitude, though. I'm sure everyone online loves helping people with attitude.

DetailViewController is the class (I believe) that XCode generates for you when you pick a Master>Detail Project from the template browser. Pretty sure it just is a regular view controller with a white view, and it may have a text label on it that says something like "detail view"
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.