UITabBarController disappear in Three20 TTThumbsViewController - xcode

I'm having trouble put TTThumbsViewController and UITabBarController together. The tab bar will disappear when switched to TTThumbsViewController of Three20. I've read all questions in stack overflow and nothing really helped. And I even tried to set all
self.wantsFullScreenLayout = NO;
self.hidesBottomBarWhenPushed = NO;
in my thumbsviewcontroller and in Three20UI project. None of these methods work.
I'm building my app in Xcode4 with storyboard and adding this thumbs gallery is the last part.

I realise this is an oldish post but if you use:
self.wantsFullScreenLayout = NO;
self.hidesBottomBarWhenPushed = NO;
IT means that the push has already taken place therefore negating the command. Use this instead:
GalleryViewController *gallery = [[GalleryViewController alloc] init];
gallery.wantsFullScreenLayout = NO;
gallery.hidesBottomBarWhenPushed = NO;
Then push it. This works.

I ended up solving this problem by remove the three20 navigation bar in my code and simply use the uinavigationcontroller in storyboard. I don't know why, but problem solved. I hope this can help those like me using storyboard with three20.

Related

iOS 9 Bug when using presentViewController "EXC_BAD_ACCESS code=2"

First. IT WAS working until this last update from Apple. So in theory it should still work.
Here's the code:
CarouselViewController *cViewController = [[CarouselViewController alloc] initWithContent: edition];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController: cViewController];
[self presentViewController: nav animated: YES completion:nil];
The reason i'm doing it is because i need this new window to be presented in fullscreen and not inside this ViewController (the caller) which is occupying half of the screen.
So, HOW can i fix this? And why BEFORE it was working and now with this silly iOS 9 update it isn't?
My guess (and that's all it is with the limited information presented) is that the root cause of the problem has something to do with CarouselViewController and it's view actually being loaded and presented on screen.
That is what is happening in your app during this line
[self presentViewController: nav animated: YES completion:nil]
I would set a breakpoint in that ViewController subclass loadView/viewDidLoad or check out it's Nib/Storyboard.

xcode change label's text after presentViewController

as always relying on this community wich is always really helpful!
I really don't understand why my code isn't working, i am playing the game in ViewControllerA for example, there is "movements" and more stuff shown,wich are labels with int variables shown, this ones give me no problem because they change correctly,when the game is completed i want to show the score and more...
So i created another ViewController to do it, ViewControllerB for the example, the thing is that A and B Viewcontrollers belong to the SAME class, so i should be able to use the same variables, methods and everything ( actually i do that already and it's working fine)
I created IBOutlet for some labels, this ones belong to B. I am using presentViewcontroller method to show it up,the labels don't get anything changed, here is the code:
NSString *moviments = [NSString stringWithFormat:#"%d",TotalMovements];
NSString *score = [NSString stringWithFormat:#"%d",TotalPoints];
NSString *levelToShow = [NSString stringWithFormat:#"%d",PlayingLevel];
[movementsToShowOnCompletedScreen setText:moviments];
[scoreToShowOnCompletedScreen setText:score];
[levelToShowOnCompletedScreen setText:levelToShow];
UIStoryboard *winOFLevelStoryboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *vc = [winOFLevelStoryboard instantiateViewControllerWithIdentifier:#"mainGame"];
[self presentViewController:vc animated:YES completion:^{
/*I have tried to add the same code from above setting the labels text
labels here, same result...
*/
}];
The labels don't get its text changed.
This is it, i hope with all of this you can find out what's going on here, the IBOutlets are fine, i even changed programmatically the frame of those labels before so that can't be the problem, outlets are fine.
If you need more code or anyhthing just let me know!
Thanks for your time !
Well, i found it...just in case anyone has the same problem. It solves it but not the way i wanted to so if anyone knows the good way please let me know.
Since those belong to the same class i have just copied/pasted this lines shown below to my viewdidload method, now labels are changing when they have to but i really think this is a really poor solution.
Thanks again!

Unexpected nil window in _UIApplicationHandleEventFromQueueEvent

One of my old apps is not working with iOS8. When I start the app up, and try to tap on the screen anywhere, I get this message in my console:
unexpected nil window in _UIApplicationHandleEventFromQueueEvent,
_windowServerHitTestWindow: <UIWindow: 0x7fe4d3e52660; frame = (0 0; 320 568);
opaque = NO; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fe4d3e2c450>;
layer = <UIWindowLayer: 0x7fe4d3e86a10>>
I'm using an old style MainWindow.xib. In the MainWindow.xib is my Window object, as well as a UINavigationController which has its first View Controller defined within as well. The image below is showing the Outlets connected to the App Delegate.
The white "view" in the screenshot below is the UIWindow. The view on the right is the UINavigationController (nav bar hidden) with the first ViewController defined inside it.
How do I fix this without recreating the entire app from scratch with a new project?
EDIT: I just discovered there is a TINY strip wherein my buttons will actually receive their taps/clicks.
I've also noticed that my self.view.window is nil. How do I make sure that is set?
Additional to B H answer. Also look this answer.
Got this issue when launching my landscape only app from portrait orientation (also the app shouldn't be presented in recently opened apps list, which can be seen by pressing Home button twice. Perhaps, iOS somehow caches the orientation and window size).
My code was
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window makeKeyAndVisible];
I set W+H autoresizing mask for window, it didn't help me, because the window don't being resized on rotation, but the transform matrix is changed.
The solution is simple
self.window = [UIWindow new];
[self.window makeKeyAndVisible];
self.window.frame = [[UIScreen mainScreen] bounds];
So the frame is set AFTER the window get its orientation from root view controller.
You don't have to add any code to fix this.
Open the main xib file and find "Window" from the left side and enable Visible at Launch and Full Screen at launch.
Check out your Window nib file and make sure it is taking up the full screen. I had a similar issue on my app where touch events weren't being registered on a strip on the right side. Once I set my MainWindow.xib to take up the Full Screen, I had no more errors and touch events were working again. My app was also being displayed in Landscape but my MainWindow.xib had portrait dimensions.
Sometimes it's just simple setting that's missing some value: Click on Project(whatever you named your project) name item then make sure General tab is selected and scroll to the bottom. Look for App icons and Launch Images make sure there is some value in the Launch Screen File field, this should be either Main or LaunchScreen
In case somebody finds this useful:
In my case, I had used
self.window = [[UIWindow alloc] init];
instead of
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
and that was the reason for the problem.
I was getting this error on an old app that did not have the Default-568h#2x.png launch screen. When the taller iPhones were first introduced, this was the signal to iOS that the app could handle the new geometry. Otherwise, it was displayed in a 320x480 window. Funny, I did not even notice the app was not using the full screen.
I wasn't able to test efpies solution, but the way I fixed it in my app was to replace the MainWindow.xib with a Storyboard.
We had the same issue, and we tried the proposed solutions in this thread without success.
What ended up working for us, was to re-write the logic to be pure programmatically instead of using xib's. After this we don't see the 'unexpected nil window' error and the view is getting the hit all over the screen.
In case this helps anyone else that stumbles here, I also got this error when I had the UIScreen.mainScreen().bounds size flipped when setting the window's frame.
I am also upgrading my old project to iOS 7 and iOS 8.
Actually, I don't use MainWindow.xib, but creating window manually in application:didFinishLaunchingWithOptions:.
But i have same unexpected nil window in _UIApplicationHandleEventFromQueueEvent error after launch.
So, in my case, problem was solved by changing deployment target to 6.0 and replacing code in main.m:
Old main.m:
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
New main.m:
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([YourAppDelegate class]));
}
}
In my case it was an old code and after reading the complete code i found this line
UIApplication.shared.delegate?.window??.isUserInteractionEnabled = false
I handle it according to my logic and it's working now.
It worked for me to Enable windows user interaction.
window.isUserInteractionEnabled = true
Using the new ios 8 'nativeBounds' UIScreen property instead of 'bounds' when creating the window fixed the issue for me. No other changes required.
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] nativeBounds]] autorelease];
To support previous version too, I do a runtime check with the version:
if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)

Paging in MWPhotoBrowser not working properly after implementing custom tabbar

I'm using MWPhotoBrowser in a project and everything worked great until I implemented a custom tabbar (to make one of the tab items higher and wider). I used RXCustomTabBar as a starting point for my tabbar and only modified it a bit, no meaningful changes though.
After implementing the new tabbar and in the app open the MWPhotoBrowser I can only view the first photo. I can still scroll in the photobrowser but no other photos than the first is shown. Neither can I toggle the "fullScreenLayout" that is implemented in the MWPhotobrowser when I'm not viewing the first photo.
I'm simply confused since I have no idea what is causing this problem. I know it's a far fetched question since it's two custom made libraries I'm working with but perhaps someone has experienced a similar problem in the past. Would be very grateful for suggestions!
This is the code I use to push the MWPhotoBrowser:
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
[self.navigationController pushViewController:browser animated:YES];
I tried presenting the browser modally with:
[self.navigationController presentModalViewController:browser animated:YES];
That way the photos are shown correctly but I have no navigation bar.
After hours of headache I came up with a solution:
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
[browser setInitialPageIndex:indexPath.item];
UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:browser];
[self.navigationController presentModalViewController:navBar animated:YES];
I.e. I create a UINavigationController in which I embed my MWPhotoBrowser and then present the navigationcontroller modally.

Storyboard in Xcode is so slow

I have 150 UIViewController in Storyboard and scrolling between these Views is so slow. I can't zoom in and zoom out easily and it takes some serious time to do sty.
I'm on MBPR and I installed Xcode 4.4
Spec: 2.3GHz / 16G / 256 which I think it's enough to handle such a thing.
Is there any options, settings, or tips/tricks to have so many views in storyboard and don't miss the performance.
NOTE: I've done all the possible solutions (deleting cache and workspace). Didn't work. It has something to do with number of UIViewController in Storyboard.
Thanks
Update 2016: Just to update this question as there is a new feature in Xcode 7 that allows you to refactor the Storyboard into multiple Storyboards.
Refactoring Storyboards
https://developer.apple.com/library/ios/recipes/xcode_help-IB_storyboard/Chapters/RefactorStoryboard.html
If you search the term "refactoring storyboards" you will find good tutorials :)
It is considered best practice to split up storyboards into lots of different modules (each one in a separate storyboard). It will take away these performance issues you are having and also has other advantages such as making it easier to manage in general (no massive SVN conflicts etc).
However I had another issue which was causing storyboard lag. I had approx 25 view controller and was receiving ALOT of lag - but only when Xcode was running on an external monitor.
I noticed that if I disabled "auto layout" for the storyboard, the lag would completely disappeared. I reverted this change, and then followed the following process:
-Delete a ViewController
-test if it still lags
-if still laggy revert changes
Eventually I found a certain ViewController which if deleted stopped all lag. I then reverted this and went through the views to see which view caused the lag. I eventually narrowed this down to a "UIButton" inside a "UIBarButtonItem". I believe I changed the "Type" property on the button, and then changed it back and the lag stopped. From SVN it seems like the frame was changed in the .storyboard file. After this point the lag never came back again.
TLDR:
Storyboard lag is not always because you have too many items in the storyboard. I managed to get rid of a lag problem by causing Xcode to re-do some layout.
Hope my experience will help someone else diagnose/solve their problems. I was working for about 0.5 years before I finally got really annoyed and tried to solve the issue.
Definitely use multiple storyboards for this. I am not aware of any limitations in using storyboards but trying to render all those UI code at one time is hard for your machine and it is also hard for developers to understand.
Try to logically divine your storyboards into categories such as: "profileSB, feedSB, mapSB, messagesSB, settingsSB"
Here are some good tutorials on the creation of these:
http://spin.atomicobject.com/2014/02/18/ios-storyboards-xcode5/
http://www.skillmasters.net/main/xcode-using-multiple-storyboards/
150 ViewControllers in one Storyboard sounds awful lot to me.
Try to minimize your flow or split into multiple storyboards if you really need so many
I had a UIStoryboard with 10 or more UIViewControllers and additional ContainerViews. After layouting the views and customizing more and more, the UIStoryboard got more and more lazy.
My approach was to setup the views inside single UIStoryboards. Loading the controllers is done inside my Menu, where I setup an NSArray with all identifiers for the UIViewController which also have to be setup inside the UIStoryboard:
When loading the menu, I loop through the NSArray and load the UIViewControllers by identifiers from the specific UIStoryboard. This is the place where I needed to implement a switch, for the different UIStoryboards:
self.arrayVCAll = [NSMutableArray new];
for ( NSArray *array in _arrayViewControllerAll ){
NSMutableArray *arrayTemp = [NSMutableArray new];
for (UIViewController *vc in array ){
NSString *strViewController = [NSString stringWithFormat:#"%#", vc];
UIStoryboard *storyboard;
if( [strViewController isEqualToString:#"CustomOneStoryboard"] ){
storyboard = [UIStoryboard storyboardWithName:#"FirstVC" bundle:nil];
} else if( [strViewController isEqualToString:#"CustomTwoStoryboard"] ){
storyboard = [UIStoryboard storyboardWithName:#"SecondVC" bundle:nil];
} else {
storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
}
UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:strViewController];
MyNavController *nav = [[MyNavController alloc] initWithRootViewController:controller];
[arrayTemp addObject:nav];
}
[self.arrayVCAll addObject:arrayTemp];
}
In my case, there was just a problem with the segues after separating the initial UINavigationController from my UIViewControllers. The segues won't push to a navigationController, if there is no initial UINavigationController. Thats why I added a UINavigationController on each UIViewController (of my NSArray) so the UIStoryboardSegue will be done correctly. The UINavigationController also doesn't need to be connected to a class, just include it inside the UIStoryboard and connect it to the first UIViewController.

Resources