Discussion Forums  >  Status Bar, Navigation Bar

Replies: 14    Views: 221

Jake Chasan
Veteran developer
Profile
Posts: 1684
Reg: May 13, 2011
location unknow...
29,640
01/27/14 09:47 PM (6 years ago)

Solution: Transition Fix for BT3.0, iOS 6 and iOS 7

Hi Everyone,

This forum post is dedicated to solving a pressing visual issue with BT projects on iOS 7: When a user taps on a screen, the background view instantly changes and the old screen is still present, causing a visual error, see this video for a demonstration: http://jakeserver.com/Uploads/Buzztouch/Background_Transition_iOS_7_Problem.mov

After reworking the code initially posted by Niraj on behalf of Chris1, here is the completed code. Here is the original post: https://www.buzztouch.com/forum/thread.php?tid=DD9A4A2A13632942789817D

Code Fix:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In the pluginís .h file:

1) Between the curly braces, add, after the @interface:
UIView *backgroundView;

In the pluginís .m file:

3) In the viewDidLoad method, near the top add:
//init background view
backgroundView = [UIView new];
backgroundView.frame = [[UIScreen mainScreen] bounds];

4) In the viewDidLoad section, look for all the "addSubview" methods and replace like so:

old: [self.view addSubview:headerImage];
new: [backgroundView addSubview:headerImage];

old: [self.view addSubview:myTableView];
new: [backgroundView addSubview:myTableView];

5) In the viewDidLoad section, near the bottom add:
//add background view
[self.view addSubview:backgroundView];

6) In the viewWillAppear section, find the "//setup navigation bar and background" code and add the following below it:

In the viewWillAppear here is the updated code (it goes at the bottom of the function). You must change out YOURAPPNAME to your project name.

//appDelegate
YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];

//set backgroundView image/color
NSString *bgColor = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"backgroundColor" defaultValue:@"clear"];
NSString *bgImage = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"backgroundImageNameSmallDevice" defaultValue:@""];
if ([appDelegate.rootDevice isIPad]) {
bgImage = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"backgroundImageNameLargeDevice" defaultValue:@""];
}

if ([bgColor length]>0) {
UIColor *bgColorObj = [BT_color getColorFromHexString:bgColor];
backgroundView.backgroundColor = bgColorObj;
}
if ([bgImage length]>0) {
UIImageView *bgImageView = [UIImageView new];
bgImageView.frame = backgroundView.frame;
[bgImageView setContentMode:UIViewContentModeScaleToFill];
if ([BT_fileManager doesFileExistInBundle:bgImage]) {
bgImageView.image = [UIImage imageNamed:bgImage];
}
else if ([BT_fileManager doesLocalFileExist:bgImage]) {
bgImageView.image = [BT_fileManager getImageFromFile:bgImage];
}
[backgroundView addSubview:bgImageView];
[backgroundView sendSubviewToBack:bgImageView];
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I hope this helps.

Jake
 
chris1
Code is Art
Profile
Posts: 3860
Reg: Aug 10, 2012
Oklahoma City, ...
50,100
like
01/27/14 10:21 PM (6 years ago)
Even better, place this in the BT_viewController.h and .m files - that way it affects all plugins :)
 
mysps
Code is Art
Profile
Posts: 2081
Reg: May 14, 2011
Palma
33,310
like
01/28/14 01:34 AM (6 years ago)
Nice! Thanks Jake, but more importantly where is the location of the background picture of the video?

:)
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
01/28/14 02:31 AM (6 years ago)
Sound like this improves transitions for all situations. Will this make it into the BT Core ?
 
fusionsch
I hate code!
Profile
Posts: 512
Reg: Dec 28, 2010
Montreux Switze...
11,570
like
01/28/14 07:16 AM (6 years ago)
@Jake: thanks for the fix!

@Chris1: I'd like to use this fix in the BT_viewController.h and .m files but I can't find the right place to put these lines of code...

Could anybody put BT_viewController.h and .m sample files somewhere so that code haters may enjoy the fix? Thanks in advance!

Cheers

Jack
 
EdReyes
Lost but trying
Profile
Posts: 574
Reg: Oct 21, 2013
location unknow...
17,640
like
01/28/14 11:32 AM (6 years ago)
@Jake is this part of what you were helping niraj fix this past weekend?
 
Arubaman
Aspiring developer
Profile
Posts: 636
Reg: Oct 20, 2011
Akron
16,910
like
01/28/14 01:07 PM (6 years ago)
Thanks for the code fix.
 
NCbuzz
Code is Art
Profile
Posts: 575
Reg: Sep 11, 2013
Lillington, NC
11,100
like
01/31/14 09:56 AM (6 years ago)
Having issues implementing. BT3

Looked at solution for All plugins:
BT_viewController.h and .m files -no place to make changes in section #4?

Trying to implement in a single Plugin (parsechannels):
Could not find area to implement #6

Chris have you already implemented your suggestion and can update this thread?
======================
Does anyone know when Core will be updated rather than trying to fix in individual plugins?
 
Jake Chasan
Veteran developer
Profile
Posts: 1684
Reg: May 13, 2011
location unknow...
29,640
like
02/01/14 10:19 AM (6 years ago)
@NCbuzz: Which plugin are you having a hard time with? Most plugins (if not all) should have a function named -(void) viewWillAppear

Jake
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
04/07/14 02:31 AM (6 years ago)
I just tried to implement this into the menu advanced with image plugin, all changes in the cr_menu_advanced.m and .h files. as in my app the menus are where the transition issue is the most obvious. I think it improved the transition, but it made the menu rows over-write the header image, which is a bigger problem.

Chris, can you advise if this fix can be implemented in your plugin as described and do you know if it is going to be absorbed into either your plugin an/or the rest of BT please?
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/05/14 04:30 AM (6 years ago)
Would like to echo what others have said. Can't find the sections to replace in viewcontroller.m.
Could anyone help please?
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/05/14 05:35 AM (6 years ago)
I never did work out how to fix this, but I did find a work-around.

The problem seems to affect the default transition, so, instead of using the default, I now set it explicitly from one from the available transitions and it seems to be OK.
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/05/14 05:53 AM (6 years ago)
AlanMac, yes, that's what I did for menus but within html screens you still get the default transition. I've tried to implement it in the html_doc .m file just now and it seems to make no difference.

When I had a friend test the app, he thought it was a bug, so clearly this doesn't look good the way it is. Not sure what apple were thinking!!
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/05/14 08:42 AM (6 years ago)
Anyone?

$25 if this crazy iOS7 screen transition can be made to go away in html_doc plugin so that it doesn't happen when people click on a link inside an html file.
 
kingelessar
Lost but trying
Profile
Posts: 155
Reg: Mar 10, 2014
UK
6,500
like
05/06/14 06:37 AM (6 years ago)
Looks like in the case of html_doc, as described above, this method is the only one that works: https://www.buzztouch.com/forum/thread.php?tid=641F5075C8CA00669CD601A&fid=BC70C36A743CD4FAD95D17F&sortColumn=FT.id&sortUpDown=&currentPage=35

At least in my case as a non-coder. None of the other suggestions made above and in the linked thread made any difference to the screen transition in ios for this plugin.
 

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.