Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 30, 2013, 04:16 AM   #1
SmartiOS
macrumors newbie
 
Join Date: Jul 2012
[HELP] Create view from code for DetailView.

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

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

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

 // make Descriptiontext //
...................??

[self.navigationController pushViewController:detail animated:YES];
}
 	
-	@end
Thanks for any help.

Last edited by dejo; Mar 29, 2013 at 09:14 AM. Reason: Please do not destroy the context of your thread by editing your posts to simply say "Solved".
SmartiOS is offline   0 Reply With Quote
Old Jan 30, 2013, 04:38 AM   #2
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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...
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 30, 2013, 05:25 AM   #3
SmartiOS
Thread Starter
macrumors newbie
 
Join Date: Jul 2012
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.
SmartiOS is offline   0 Reply With Quote
Old Jan 30, 2013, 06:59 AM   #4
ArtOfWarfare
macrumors 603
 
ArtOfWarfare's Avatar
 
Join Date: Nov 2007
Send a message via Skype™ to ArtOfWarfare
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.
ArtOfWarfare is offline   0 Reply With Quote
Old Jan 30, 2013, 07:24 AM   #5
PhoneyDeveloper
macrumors 68030
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
Put all the code to configure the DetailViewController's view in its viewDidLoad or loadView method.
PhoneyDeveloper is offline   0 Reply With Quote
Old Jan 30, 2013, 07:55 AM   #6
waterskier2007
macrumors 68000
 
waterskier2007's Avatar
 
Join Date: Jun 2007
Location: White Lake, MI
Send a message via AIM to waterskier2007
Quote:
Originally Posted by ArtOfWarfare View Post
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"
__________________
2012 Mac Mini, 2.6 GHz, 16GB RAM, 1TB HDD
2.4Ghz 15" Macbook Pro
16 GB iPhone 5 : 32 GB iPhone 4S : 16 GB iPad 3
16 GB Nexus 7 (2012)

Last edited by maflynn; Jan 30, 2013 at 11:56 AM. Reason: Removed name calling
waterskier2007 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
How do I create an ipad app that allows the user to enter and run code? 8220347 iPad Apps 5 Oct 12, 2013 02:39 PM
How to create a Modal View Programmatically (and dismiss it) roeik iPhone/iPad Programming 10 Aug 15, 2012 02:36 PM
Whats Wrong With My Code? (Presenting Modal View) loon3y iPhone/iPad Programming 2 Jun 14, 2012 03:22 PM

Forum Jump

All times are GMT -5. The time now is 09:05 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC