Still new and learning so please please bear with me. I have two issues regarding this topic. A little background. I have developed a app that has 5 tab bar items. One tabBarItems' view (the home view) has 5 buttons. One of these buttons loads the RootViewController for the open source [FGallery Slideshow Project] (https://github.com/gdavis/FGallery-iPhone) created by Grant Davis. I incorporated a good portion of the features into my app. Using a UIButton in HomeViewController I push to the RootViewController which is edited to suite my needs. I made some additions and omissions.
ISSUE 1: MOST IMPORTANT
I have a problem with the app crashing on the Go Back Button (Home if your in the initial load of the RootViewController).After the RootViewController loads I can step through the gallery functions just fine. If I click back (to the previous view) it will crash on Going back to HomeViewController with the following error in the app delegate:
"Thread 1: EXC_BAD_ACCESS(code=11, address=0x10)"
it appears on this line of code:
#import "MyAppleAppDelegate.h"
int main(int argc, char *argv[])
{
#autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([MyAppleAppDelegate class]));
}
}
ARC is omitted on the classes that make up the Gallery. The rest of the app uses ARC.
Target build is 7.1. Everything works fine if loaded using 6.1 by programmatically targeting Legacy UI but only in the simulator. I have not had a chance to test it on a device running iOS 6.1 only 7.1. Of course with all of apples recent changes It is best to just build for 7.1. Sad thing is when I started this app 6.1 was the standard :(
HomeViewController UIButton to gallery:
-(IBAction)showGallery:(id)sender
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:#"gallery"];
[self.navigationController pushViewController:controller animated:YES];
}
ISSUE 2: NOT AS IMPORTANT I AM SURE I CAN FIGURE THIS ONE OUT BUT..
In the view that shows the toolbar which controls which image is showing. The tool bar is hidden under the TabBar along with half of the caption container. In iOS 6; No problem, they stack on top of each other the way they are so-pose to.
Thanks in advance for any help I realize this question might be a bit much.
I fixed my current main issue by converting the FGallery to use ARC.
Related
I'm currently working with an example from Raywenderlich: UISearchController-Tutorial (The finished project is at the end of their article or here) and I noticed that when I execute a search and click on one of the results, during the push transition, the UISearchController disappears. It's visible on this video: here
Before selecting a result
During the transition to the new VC
I run this example with Xcode 10, iOS 12 (sim: iPhone 8)
Any idea / pointer would be deeply appreciated
Cheers.
Its default in iOS12. Just look at the Apple-Mail App. There it is the same. Actually you dont need the searchbar, when you are showing another VC
I am facing some kind of issue in my when I compile my code with xcode 7.
Here is my code:
UIViewController *vcSomeObj = [self.storyboard instantiateViewControllerWithIdentifier:#"vcSOmeClass"];
vcSomeObj.channelID = detailOfUserTable.ID;
[self.navigationController setViewControllers:#[vcSomeObj] animated:NO];
This is working fine when I compile and run my code from xcode6.4.
This thing hang my application. And when I goes to any app and come agian to my app it will take to main controller and after sometime app crashes.
I can't find anything in debug.
In storyboard file We need to select English check box also otherwise application will hang an crash.
In my opinion.you set the current navigation's viewcontroller.what's happen to current viewController in navigation stack when you in current viewController,so ,I guess you can do like this
[self.navigationController setViewControllers:#[vcSomeObj,self] animated:NO];
I am currently developing an iOS application for both iPhone and iPad. I'm trying to show a NavigationController to make a module that shows files. In an iPhone it works just fine, but I canĀ“t get it to work in iPad.
I'm getting the following error:
'Storyboard (<UIStoryboard: 0x919b200>) doesn't contain a view controller with identifier 'FilesNavigation''
and this is the code:
case 10: // Files
{
UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:#"FilesNavigation"];
FilesViewController *filesViewController = [storyboard instantiateViewControllerWithIdentifier:#"Files"];
[navigationController pushViewController:filesViewController animated:YES];
self.slidingViewController.topViewController = navigationController;
break;
}
And in my storyboard I have already set the Storyboard ID for the navigation controller.
>##Custom Class
>Class: UINavigationController
>##Identity
>Storyboard ID: FilesNavigation
I used this code for another case on the switch/case block for other module and it works for iPad too, its the first time that I have this error.
I figured it out, the problem was that the Storyboard wasn't updating in the device.
Uninstall the app from the simulator/iPhone/iPad
Product > Clean
Build & Run
As stated in #T0m_Twt's answer in this question
In the right pane, in the identity inspector section give a storyboard Id to your Navigation Controller.
I took a screenshot for you
Here's another case:
There are two localized storyboards. Only one of them has the view controller you want.
By chance, do you have a storyboard for iPhone and a different one for iPad? If you do, then the iPad one might not have a storyboard with that identifier. Also when running on an iPad, set a break point in your code and verify what your "storyboard" object is.
I use a category on UIStoryboard that will give me the storyboards for each platform.
I can use [UIStoryboard storyboardHome] and that will determine if it needs iPad or iPhone specific and return that to me. I also ensure my storyboards follow proper naming. So I would have Home_iPad and Home_iPhone.
TL;DR - clear everything and remove old version of the app as well, if there's any.
It may sound crazy, but suppose that if you have changed target name which changed bundle name as well, you might have both the old and new version of the app installed in the simulator / device, and this might cause trouble for the UIStoryboard instance failed to instantiate some view controllers, which might eventually cause the trouble described in the question. To solve it, you need to remove all related apps or simply reset the simulator / device.
I currently have an Xcode project that uses storyboard and I have an Xcode project in which I followed a tutorial and made a simple weather view controller. This Weather view controller uses CocaPods and requires that I use .xcworkspace whereas in my previous Xcode project (the one in which I am making via storyboard) I have been using the .xcodeproj file. I am trying to bring the weather view controller project into my storyboard Xcode project. Hopefully, I will have a button on one particular view controller link to the Weather View Controller that was initially created in another application.
I have asked a previous question in regards to a project like this but with no luck. The previous question can be seen here: combining-two-xcode-projects-one-with-code-and-one-without
In order to test the one answer I as given on that previous question I went about and created a blank Xcode Project from scratch, uploaded all of the .h and .m files, and then went into terminal (I am using mac) and programmatically the pods. The pods installed perfectly. I then put down a button and used the IBAction mentioned in the question I posted the link to above:
//When the button is tapped
-(IBAction)buttonTapped:(id)sender
{
//initialize the code only controller
WXController *WXController = [[WXController alloc] init]
//present the view
[self presentViewController:WXController animated:YES completion:nil];
}
I then ran the project and came across this error that highlighted this piece of code:
WXController *WXController = [[WXController alloc] init]
The error stated:
"No Visible #Interface for 'WXController' declares the selector alloc"
Just to make sure nothing else worked, I also tried to open the same project with .wcworkspace and came across the same error which I wasn't able to figure out.
I figured it must have been a button with the linking of the view controller with the button so not only did I post prior to this but I also did my own research and didn't have any luck as well. I checked out these posts:
How to combine two projects into one project
Loading a storyboard from a different Xcode project
Just to make the question I'm asking more clear, I included a link to the Weather Xcode Application I am trying to link to my storyboard application. You should be able to open the application here: Link
I was wondering: What exactly am I doing wrong that is providing me with the "No Visible #Interface for 'WXController' declares the selector alloc" error and even if this is fixed, am I missing something or should the view controller display properly.
Also, I have previously been using the .xcodeproj for my storyboard Xcode application. Is it necessary that once I bring this Weather view controller in, I must switch to .wcworkspace? and if so, what is the difference/ positive/ negatives of each?
I was given a project that was started by someone else who no longer works here.
I have a UITabBarController which holds some UIViewControllers.
If the application is running on iOS 6, everything runs fine, However as soon as I run it on iOS 5, all UIViews are rotated 90 degrees and given an origin value of something around -100 to -300
I have been able to loop through all view controllers of the tabBar and set
myView.transform = CGAffineTransformMakeRotation(0.0);
myView setFrame:CGRectMake(0,0,1024,748);
The initial view controllers on UITabBarController appear correctly, However, if I ever try to launch a modal view controller, everything is stuffed again. including the modal.
I am running out of ideas on how I could fix this once and for all. I couldn't find anything in the code that rotates the views.
What I could deduce is
on iOS 6, the first subview of the main view holding the UITabBarController is UILayoutContainerView
but on iOS 5 the first subview is of class UIView
If this is an issue with UILayoutContainerView not being supported in iOS5, how can I make the application backwards compatible now?
Note: we only support Landscape (Right/Left) and only on iPad.
Also, I have noticed that if the user rotates the application before initialiazing the UITabBarController and its sub controllers. everything works fine. Even if you re-run the application and not rotate again, still works.
Thanks in advance
If you want your application to stick in landscape mode you the blow code, the issue resides in iOS 5, many people face this issue
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
BOOL returningValue=NO;
if (interfaceOrientation==UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
returningValue=NO;
}
else if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
{
returningValue=YES;
}
return returningValue;
}
Apparently, this is where I went wrong
For iOS 5
when setting the view of the main window of the application, one must use
[self.window addSubview: tabBarController.view];
Instead of (iOS6 only)
[self.window setRootViewController: tabBarController];
I am unsure how that changes everything, and the reason it won't work for iOS 5. Nevertheless, it worked.
Thanks everyone :)