Discussion Forums  >  Uncategorized

Replies: 9    Views: 275

oliegoboadams
I hate code!
Profile
Posts: 7
Reg: Jan 28, 2012
brighton
570
02/04/12 11:52 AM (14 years ago)

1.5 START QUIZ button - NOT quizBG

Hi Guys ... this isn't a query about the quizBg_small/large ... Im using 1.5 and have discovered i cant find the png to replace so i can have my own customised START QUIZ button. After looking at an old 1.4 proj with quiz have discovered that had a Start Quiz png however 1.5 projects dont seem to. Is it possible to edit the BT_screen_quiz file so that it loads a png in the BT_images/quizimages folder? (i assume it is - just probably a bit out of my comfort zone without a bit of help?? SOOO has anybody managed to achieve this or have any help regarding how this would be achieved in the most simple manner? Thanks Alot :)
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
02/04/12 11:57 AM (14 years ago)
I am going into the depths of my meomory here (very shallow), I rember doing a quiz app and the images were in the BT_images ->Quizimages and were under quizBg_small.png (or quizbg_large.png for ipad). I may be incorrect but I know I used these in my 1.5 app MArk
 
oliegoboadams
I hate code!
Profile
Posts: 7
Reg: Jan 28, 2012
brighton
570
like
02/04/12 12:12 PM (14 years ago)
Hi mark! Thanks for the swift reply. I have already managed to replace the quizBG_small and large images for my quiz - its the actual START QUIZ Button that you press to begin the quiz that im hoping can be replaced... I'e rummaged all the way through all the folders and files the only reference to the start button is ... //start button box is a view with two subviews. Start button is initially hidden before until the parseData method completes. startButtonBox = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; startButtonBox.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [startButtonBox setAlpha:0.0]; ?????????????? Also downloaded your cv resume app earlier to have a look at something someone else created on BT ... Gave you a nice rating - jus got to re-write my cv now! ;)
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
02/04/12 01:36 PM (14 years ago)
Thank you for the lovely comments on cv/resume app I had to go to xcode and run my quiz app, David advised me to follow the output screens in xcode to see whats going on this is what I got 2012-02-04 20:25:44.394 ponyfun[476:207] BT_screen_quiz: parseScreenData 2012-02-04 20:25:44.394 ponyfun[476:207] BT_screen_quiz: layoutScreen where ponyfun is the app I wrote for my daughters. I am wondering if the start quiz is related to layoutscreen? Hope this helps in some way (ps is that a panda or have you given your teddy a black eye
 
oliegoboadams
I hate code!
Profile
Posts: 7
Reg: Jan 28, 2012
brighton
570
like
02/04/12 01:55 PM (14 years ago)
Thanks alot yea i thought was something to do with that part im gona try opening up the interface builder an having a look... If i work it out ill post how i did it here. Ha ... Not a panda .. its a Meerkat teddy
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/04/12 04:57 PM (14 years ago)
I haven't tried to change this yet, but the section you need to modify is in the BT_screen_quiz.m file: //start button box is a view with two subviews. Start button is initially hidden before until the parseData method completes. startButtonBox = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; startButtonBox.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [startButtonBox setAlpha:0.0]; //transparent mask UIView *startMask = [[UIView alloc] initWithFrame:CGRectMake(0, -50, 1500, 1500)]; [startMask setBackgroundColor:[UIColor blackColor]]; [startMask setAlpha:.60]; [startButtonBox addSubview:startMask]; [startMask release]; //create rounded rectangle start button startButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [startButton setFrame:CGRectMake(margin, answerButtonBoxTop + 5, answerButtonBoxWidth, buttonHeight)]; startButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; [startButton addTarget:self action:@selector(startQuiz) forControlEvents:UIControlEventTouchUpInside]; [startButton.titleLabel setFont:[UIFont boldSystemFontOfSize:30]]; [startButton setTitle:NSLocalizedString(@quizStart,@start quiz) forState:UIControlStateNormal];
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/07/12 12:10 AM (14 years ago)
@oliegoboadams - I've got a solution for you. I based this off of a tutorial I found here: http://mozymac.com/forums/f54/how-make-uibutton-image-programmatically-coding-815/ Replace the code in the '//create rounded rectangle start button' with the following: //create rounded rectangle start button startButton = [UIButton buttonWithType:UIButtonTypeCustom]; //sets the type of UIButton UIImage *buttonBackgroundImage = [UIImage imageNamed:@'button.png']; UIImage *stretchedBackground = [buttonBackgroundImage stretchableImageWithLeftCapWidth:73 topCapHeight:0]; //startButton is declared as an instance variable UIButton in the interface [startButton setBackgroundImage:stretchedBackground forState:UIControlStateNormal]; [super viewDidLoad]; [self.view addSubview:startButton]; [startButton setFrame:CGRectMake(margin, answerButtonBoxTop + 5, answerButtonBoxWidth, buttonHeight)]; startButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; [startButton addTarget:self action:@selector(startQuiz) forControlEvents:UIControlEventTouchUpInside]; [startButton.titleLabel setFont:[UIFont boldSystemFontOfSize:30]]; [startButton setTitle:NSLocalizedString(@quizStart,@start quiz) forState:UIControlStateNormal]; [startButton.titleLabel setShadowColor:[UIColor blackColor]]; // OPTIONAL ADD DROP SHADOW [startButton.titleLabel setShadowOffset:CGSizeMake(0.0f, -1.0f)]; // OPTIONAL DROP SHADOW Remember to change the single quotes to double quotes around 'button.png' I'm using a button.png file that's 129px x 90px. If you look at that tutorial you'll see why I did this. The graphic can be stretched to work for both iphone and ipad screens. One other additional thing I added to my script was a slight drop shadow on the 'start quiz' title. Note the two commented 'OPTIONAL' lines above. Good luck.
 
Marko
buzztouch Evangelist
Profile
Posts: 558
Reg: May 04, 2011
UK, Alcester
8,880
like
02/07/12 12:43 AM (14 years ago)
@MGoBlue - great post really helps, also a new area to get advice in coding for beginners is cool - mozy mac
 
MGoBlue
Apple Fan
Profile
Posts: 980
Reg: Jun 07, 2011
Gold River, CA
10,600
like
02/07/12 08:47 AM (14 years ago)
@Marko - thanks. Yes, I've found some pretty interesting and useful tutorials with a little searching. This is pretty interesting (best viewed on your iphone). If you do a show page source in your computer browser, you can see some of the simple codes they used. Pretty cool stuff. http://groupaware.mobi/iphone/#_Samples
 
oliegoboadams
I hate code!
Profile
Posts: 7
Reg: Jan 28, 2012
brighton
570
like
02/07/12 10:40 AM (14 years ago)
@MGoBlue - wow thank you very much. i had spent a while trying to copy some code for a UIButtonTypeCustom i had found but caused myself problems (something about the json.h) and my app began crashing so i just gave up on replacing it. also as Marko said - thanks for the mozymac link. Can't wait to get a few hours free to get it done now :)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.