Hi guys, I'm unable to switch to 2.x SDK because I can't figure out how to convert my working 1.9 code. Here's what I'm doing:
I have a tableview with transparent rows of variable height based on content.
- I have a tableview with background set to "transparent".
- The tableviewrow has no background and no height defined which defaults to 'auto'
- I add a haze view to the tableviewrow which stretches to the edge - 10 and has opacity set to .5.
- I add labels to the tableviewrow. labels are stacked with top of the bottom label set to height+top of the previous label.
All this works well in 1.9 before the Ti.UI.SIZE and Ti.UI.FILL changes. I have not found a way to do this in 2.0.
I've tried - using vertical layout: no good. Can't get the haze to work. - using toImage().height: YIYES. Sounds awful. - using .rect and .size but they don't populate until after the layout - using postlayout callback. no good. can't add a haze post layout since I'll go into an infinite loop.
The way I see it, this is not possible in 2.x and I'm force to give up all updates because I want a variable height tableviewrow with opacity. Seems like any SDK updates should add functionality and not remove things. Or at least have a backdoor for backward compatibility.
Here's my code in summary:
tv = new stvMod.StreamTableView({ height : 480 - 20 - 44 - 49, top : 0, backgroundColor : 'transparent', separatorStyle : Titanium.UI.iPhone.TableViewSeparatorStyle.NONE, });in a loop I add a bunch of rows:
//--------------------- // add a bunch of rows //--------------------- row = Ti.UI.createTableViewRow({ height : 'auto', post_id : args.id, post : args, selectedBackgroundColor : '#CCCCCC', }); row.add(Ti.UI.createView({ opacity : .5, backgroundColor : 'white', top : 5, bottom : 5, left : 5, right : 5, borderRadius : 5, })); content = Ti.UI.createLabel({ width : 230, height : 'auto', top : 35, left : 70, text : args.content, textAlign : Ti.UI.TEXT_ALIGNMENT_LEFT, font : __styles.fonts.M, color : __styles.colors.window // , // borderColor : 'black' }) row.add(content); var photo_top = content.top + content.height + 5; photo = Ti.UI.createImageView({ height : '200', width : '200', left : 70, hires : true, top : photo_top, image : args.photo.urls.profile, backgroundColor : __styles.colors.imageBackground, borderWidth : 3, borderColor : __styles.colors.imageBorder, shadowColor : __styles.colors.imageShadow, }); row.add(photo);
2 Answers
Accepted Answer
Hi Ben
Can you post an image of what it should look like; use something like droplr.com.
I like these sort of puzzles, especially trying to avoid all calculations, I will be on it first thing in the morning unless someone else has resolved it.
Ti.UI.SIZE ist the equivalent for 'auto', did you try that?
Your Answer
Think you can help? Login to answer this question!