Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 15    Views: 38

maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
12/09/14 07:17 PM (9 years ago)

Menu Simple Button Opacity

Is there any way to change the opacity of the buttons in David's "Menu Simple"? I know its possible in "Menu Buttons" plugin but the option is not available in the control panel for Simple. Thanks!
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/09/14 10:57 PM (9 years ago)
You want to change the opacity of the rows? I assume so that the background image will be seen, a wee bit?
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 03:28 AM (9 years ago)
Exactly. :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 04:01 AM (9 years ago)
Go to the section for "List Layout, Color" List Background Color = clear Row Background Color = clear Row Separator Color = clear Set the font colors for Title Text and Description Text In the section for "Screen Background Image", specify the name or the URL of the Image File. After you get the app published, come back and share it with us! :-) -- Niraj
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 04:17 AM (9 years ago)
Sorry! I guess I should have specified. I want to have color in the row background & row separator but want to bring down the opacity of these. Currently my settings are: "listBackgroundColor": "clear", "listRowBackgroundColor": "#006666", "listTitleFontColor": "#FFFFFF", "listRowSeparatorColor": "#FFFFFF", In the "Menu Button" plugin there is a opacity option in the CP which uses code "buttonOpacity": " ", I want to do something similar for the list. Thanks!
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 04:47 AM (9 years ago)
Ah, you will need to modify the Alpha value to be less than 1.0 I suspect that will require modifying the plugin's code. Find where the code uses "listBackgroundColor" and "listRowBackgroundColor". Follow the corresponding variables until you get to a place in the code where it sets the color. For that color statement, look on the web for it along with "alpha". For example, you may have to search for UIColor and alpha. I am only on iPhone, cannot search through that code. -- Niraj
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 05:03 AM (9 years ago)
Try looking in the .m files for the plugin. Look for "backgroundColor". Here is code that should allow for changing of the Alpha for iOS 6 and 7/8. To make a UITableViewCell background color with an alpha less than 1 for ios 6 & 7, do this: // Specify a Blue color with a bit of transparency (alpha) UIColor *myBlueColor = [UIColor colorWithRed: 68.0/255.0 green: 125.0/255.0 blue: 190.0/255.0 alpha: 0.8]; // IF running on iOS 7 or higher ELSE it is running on iOS 6 if ( [UITextView instancesRespondToSelector:@selector(textContainerInset)] ) { cell.contentView.backgroundColor = myBlueColor; } else { cell.backgroundColor = myBlueColor; }
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 04:05 PM (9 years ago)
So if I'm running iOS 7 or higher (which I am) I have to include both of the codes above?
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 05:06 PM (9 years ago)
It can't hurt to include both. However you can indeed trim it down. :-)
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 08:31 PM (9 years ago)
Ok. First of all. Thank you so much for your help! I did some more digging and came across a solution that seems to work for me! So first thing I did was change my settings in the control panel to this: "listBackgroundColor": "clear", "listRowBackgroundColor": "clear", "listTitleFontColor": "#FFFFFF", "listRowSeparatorColor": "#FFFFFF", Then in xcode in BT_screen_menulistSimple.m, I placed this code under "UITableView delegate methods" - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { UIColor *color = ((indexPath.row % 1) == 0) ? [UIColor colorWithRed:0/255.0 green:102/255.0 blue:102/255.0 alpha:.9] : [UIColor clearColor]; cell.backgroundColor = color; } Came out perfect. :)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 09:00 PM (9 years ago)
More than one way to skin that cat. Nice solution, I'm keeping it in my archives. :-) I'm puzzled about the color = ((indexPath.row % 1) == 0) statement, not sure what that exactly does. If you can share the source of where you got this code snippet, perhaps I can read more about it. -- Niraj
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 09:06 PM (9 years ago)
http://sevennet.org/2014/12/06/how-to-how-to-customize-the-background-color-of-a-uitableviewcell Its further down the page. In regards to the index.Path.row, I changed the % from 2 to 1. When it was set at 2, every other row would be completely transparent while the others would have a colored opacity according to my alpha.
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 09:08 PM (9 years ago)
I also have custom html screens. Need to research it more but any ideas on how to change the opacity on these? Thanks again for you help!
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/10/14 09:10 PM (9 years ago)
 
Niraj
buzztouch Evangelist
Profile
Posts: 2943
Reg: Jul 11, 2012
Cerritos
37,930
like
12/10/14 11:21 PM (9 years ago)
Ah yes, %2 is the ages-old approach for doing alternate items. The %1 threw me off -- I now realize that was your hack to do every row! To make every row be transparent, you can simplify the code to just this: -(void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { cell.backgroundColor = [UIColor clearColor]; } -- Niraj
 
maverick96
Lost but trying
Profile
Posts: 174
Reg: Jan 22, 2014
Orlando
3,390
like
12/13/14 09:43 AM (9 years ago)
Ok. Thank you. I did realize the transparency isn't working for iOS 7.0 or 7.1 but does for 8.0.
 

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.