Discussion Forums  >  Uncategorized

Replies: 12    Views: 194

PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
01/08/12 01:22 PM (14 years ago)

BT Server: Header Image code question (prob @david)

Hi, I'm trying to implement my header image into my screen (I created this option that is downloadable on www.buzztouchmods.com). Now I want to make this header non-scrollable (fixed position). The problem is that the height of this fixed position depends on the height of the header image and I don't know how to get around that. I managed to get it working by a static height but that's not the solution because that counts for every screen (where you can use the header image). I made an option where you can choose to select whether you want a fixed or a scrollable header image in www.myserver.com/bt-server/bt_v15/bt_includes/inc_themeMenuListHeaderHtml.php. After this line: <br/><b>Image Corner Radius</b><br/> <input type=text name=headerImageCornerRadiusSmallDevice id=headerImageCornerRadiusSmallDevice value=<?php echo fnFormOutput(fnGetJsonProperyValue(headerImageCornerRadiusSmallDevice, $jsonVars));?> > I added: <br/><b>Header Image Scroll</b><br/> <select name=headerImageScrollWithList id=headerImageScrollWithList style=width:250px;> <option value= <?php echo fnGetSelectedString(, fnGetJsonProperyValue(headerImageScrollWithList, $jsonVars));?>>--select--</option> <option value=1 <?php echo fnGetSelectedString(1, fnGetJsonProperyValue(headerImageScrollWithList, $jsonVars));?>>Yes</option> <option value=0 <?php echo fnGetSelectedString(0, fnGetJsonProperyValue(headerImageScrollWithList, $jsonVars));?>>No</option> </select> In my menu (bt_screen_menuSimpleAdvanced) I added this to the header section: //add as sub-view [self.view addSubview:headerImageView]; [self.myTableView setFrame:CGRectMake(0, 130, 320, 480)]; The 130 is the height but I got to get the variable for the height of the header image in there and don't know how to do that. I hope someone (David!!) can help me out with this. Thanks in advance. Best Regards, Danny Ps sorry for the stripped code.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/08/12 04:23 PM (14 years ago)
Hi I found out myself, That was easy (but hard to find). The solution is to change the [self,myTableView setFrame....... ] line to: [self.myTableView setFrame:CGRectMake(0, headerImageView.imageHeight, 320, 480)]; Best Regards, Danny
 
ichigo
I hate code!
Profile
Posts: 74
Reg: Jul 27, 2011
London
740
like
01/08/12 05:52 PM (14 years ago)
Thanks for the mods - just integrated it is awesome ^_^
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/08/12 05:55 PM (14 years ago)
Hi ichigo, Thanks for letting me know that your happy with it. Really appreciate it. Best Regards, Danny
 
ichigo
I hate code!
Profile
Posts: 74
Reg: Jul 27, 2011
London
740
like
01/08/12 06:02 PM (14 years ago)
No thank you for making them ^_^
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/09/12 04:44 AM (14 years ago)
Hi, Just a warning when you try this solution. It doesn't work with the iPad (yet) and is only for iPhone. Working on a solution for both. Maybe someone an idea to get this solved? Best Regards, Danny
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/09/12 05:47 AM (14 years ago)
OK, workaround for iPad in Portrait mode only. Follow instructions in file: http://dl.dropbox.com/u/3427464/Non_Scrollable.doc Best Regards, Danny
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/10/12 01:01 AM (14 years ago)
Maybe this will help too??? Because some app's will be designed to run on both iPhone and iPad you'll want to detect the size of the device before setting the frame. You can use the built in device class to figure out if the app is running on an ipad or not then calculate the frame size as needed. if([appDelegate.rootApp.rootDevice isIPad]){ set frame for ipad.... }else{ set frame fo iphone / ipod.... } Don't rely on the syntax here, it's an example but this should help get you going.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/10/12 01:09 AM (14 years ago)
Hi David, Thanks for the comment. If you look at the document I uploaded (see link) you can see I did this. //add as sub-view if([appDelegate.rootApp.rootDevice isIPad]){ [self.view addSubview:headerImageView]; [self.myTableView setFrame:CGRectMake(0, headerImageView.imageHeight, 768, 1024)]; }else{ [self.view addSubview:headerImageView]; [self.myTableView setFrame:CGRectMake(0, headerImageView.imageHeight, 320, 480)]; } }else{ For every other: replace the word heerlen with the name of your own app and then it should work. If you have any questions regarding this edit please let me know. Best Regards, Danny
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/10/12 01:16 AM (14 years ago)
Duh, didn't look. Sounds like you've figured it out. Awesome.
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/10/12 01:27 AM (14 years ago)
Hi David, Can imagine that you don't download or look at every link you see. Now I still have this only problem/trouble when I have my iPad in landscape mode because I set the height and with (when it's iPad - code from previous post) to 768, 1024. When you go in landscape mode the header is in the center and the menu or the rss feed is 100% screen width. Maybe you know a workaround for this (or another useful tip)? Posted this also in: http://www.buzztouch.com/forum/thread.php?tid=55841B6152A32C55F308616&status=&searchInput=search...&sortColumn=FT.dateStampUTC&sortUpDown=DESC¤tPage=1&doViews=1 Thanks and Best Regards, Danny
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
01/10/12 02:07 AM (14 years ago)
I dont' see all the posts, but most of them. And, for sure I can't respond to them all. I generally try to spend at least a few hours a day answering questions and just kinda go form there ;-) Try to get comfy with two concepts. a) The UIImageView's UIViewContentMode b) The concept of 'auto resizing masks' Content modes are usually easy to understand and don't change the size or position of the frame but instead change the way the image is displayed / scaled inside the frame. Auto resizing masks are used to tell iOS to adjust the frame size of something. In this case our UIIMageView. In interface builder, you set the auto resizing mask with the little icons that show the red lines around a view, like an image. These allow you to graphically decide how to scale, stretch, rotate and image when the device changes. In code, we do the same thing by setting the auto resizing masks property to the view we want to manipulate. Set this property like this: theImaveView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; Notice the pipe character in between the individual settings. There are lots of different autoresizingMask properties that you can set (separated by a pipe). Setting the UIViewContentMode and the frames auto resizing mask should allow you to get the desired behavior. autoresizingMask options: UIViewAutoresizingNone UIViewAutoresizingFlexibleLeftMargin UIViewAutoresizingFlexibleWidth UIViewAutoresizingFlexibleRightMargin UIViewAutoresizingFlexibleTopMargin UIViewAutoresizingFlexibleHeight UIViewAutoresizingFlexibleBottomMargin UIViewContentMode options: UIViewContentModeScaleToFill UIViewContentModeScaleAspectFit UIViewContentModeScaleAspectFill UIViewContentModeRedraw UIViewContentModeCenter UIViewContentModeTop UIViewContentModeBottom UIViewContentModeLeft UIViewContentModeRight UIViewContentModeTopLeft UIViewContentModeTopRight UIViewContentModeBottomLeft UIViewContentModeBottomRight
 
PSMDanny
Apple Fan
Profile
Posts: 1166
Reg: Dec 09, 2011
Heerlen
21,940
like
01/10/12 02:33 AM (14 years ago)
Thanks David, I think this is useful information but far away from my skills to do something with it. I'll try to dive into this and see if can bake some cake Best Regards, Danny
 

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.