Integrating one iOS project into another iOS project [duplicate] - ios

This question already has answers here:
importing one Xcode project into another
(2 answers)
Closed 6 years ago.
I have one existing project. Now i have developed one project with some new feature. Need to integrate the existing project to this. When i run this project it shows this app functionalities. On that one button click to show the existing project home page and continue that existing project. I need to enter the existing project and use that functionalities and UI whatever and exit from that to continue the current project. Kindly give me solution. If you don't know requirement ping me i will explain with detail.

You can possibly add the project folder of your project to your existing project and then once you are in your existing project on the click of your button you can do this,
UIStoryboard *sb = [UIStoryboard stoaryboardWithName:#"Main" bundle:nil];
This will load the storyboard of your new project, if you have made the project using xib then you can load the xib as well
Then you can,
ViewController *firstController= [sb instantiateViewControllerWithIdentifier:#"firstController"];
This will load the view controller of your new project, then you can do this to present this view controller,
[self.viewController presentViewController:firstController animated:YES completion:nil];
This will load your view controller now you can do what you want in your new project.
To comeback to your existing project you can set your new project delegate to be your old project and implement methods to comeback.
Hope this helps.

Related

framework with view controller and storyboard

Is it possible to create a cocoa touch framework in swift which contain storyboard and viewControllers?
If yes can you give me a reference to a guide or something to get started? all the examples i see of creating frameworks are very simple classes which don't involve ui
I want to create a framework which involve UI
Yes, that is possible.
All you have to do is to create a cocoa framework as you normally do from File > New > iOS - Cocoa Framework..
Since this involves UI, Click on the project and right click > New > iOS - Storyboard. And after that it is just as simple as you do it in a normal app. Once your stuff is over in the framework side, you gotta create a new project to test your framework with UI (make sure that the class created in fw is a public class ).
To load the storyboard of your framework instead of your sample project's storyboard, do the full in ViewWillAppear method.
Create an object for storyboard along with the bundle (of your framework - normally it will be your VC's name)
instantiateInitialViewController
And present them
And you'll have your framework's storyboard in your sample project.

Bringing In An Outside Project Made Through Code To An Xcode Project Made With Storyboard

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?

How to create an iOS project with a XIB in XCode 5

I'm running xcode 5.0.1. In previous version Xcode, there was to be a checkbox for not using storyboard when creating a ios project. How do I turn off storyboards and just use xib files in xcode 5.0.1?
Unfortunately, the built-in project templates in Xcode 5 mandate storyboards, unless you pick the Empty Application template. Your choices therefore boil down to:
Start every project as an Empty Application and add your view controllers from the ground up
Start using one of the storyboard-based templates, then:
Delete the storyboard file
Change the main storyboard setting in your project to be empty
Add .xibs to the existing view controllers as needed
Implement your app delegate methods as needed to set up a view controller hierarchy
Open a new project as an empty project. The selection is in the bottom row, second from the right. Then you can add your view controllers in your app delegate. Hope this helps.

UIStoryboard keeping old outdated references

In my iPad app that uses a UIStoryboard I used to have UITabBarController with a couple tabs and icons. Since then I have refactored my app to not use the UITabBarController (deleting the view controller in the storyboard. However, when I run my app I get the following error:
Could not load the "3dicon26better.png" image referenced from a nib in the bundle with identifier "com.xxxxx.yyyyyyy"
The icon in question was used as the tab bar icon in the old UITabBarController. Apparently my storyboard is keeping references to old deleted view controllers. Is there any way to clear them out?
Don't have a great solution, but I was able to stop the error by using a process I found in another SO post (can't remember where I found it).
Open my Storyboard in textedit. Search for references to the image in question. Comment them out XML style.
This stopped the errors, but it bothers me that my Storyboard has so many extra dead references in it. :/

Generating a view programmatically in iOS

Update:
Thanks for all the tips, everyone. The tutorial mentions that a XIB file is provided (which I don't have) so I'm doing something wrong in how I'm creating the the project.
I am following Apple's Core Data Tutorial for iOS. This tutorial has not been updated for ARC—apparently for Xcode 4, since it asks to "create a new project using the Window-Based Application template in the iOS section."
Since that option doesn't exist under Xcode 4.4.1, I looked around Stack Overflow and read that I should create an empty application. As per the tutorial instructions, I created no Storyboard or NIB file.
Other than updating the code for ARC (using strong in place of retain and not implementing the provided dealloc method), I'm confident that the code in my project matches that of the tutorial up to the end of the chapter "The Table View Controller." At this point, the tutorial says I should be able to run the project and get a view.
Instead, I get a blank, black screen.
Maybe my problem is too vague to solve here, but should I perhaps be using a different project template? Which one?
I have only two classes: a RootViewController and an AppDelegate. AppDelegate imports RootViewController and contains a UIWindow property. Again, there is no Storyboard or NIB in the project.
I can provide any code too if there's someplace specific to look.
If you want to check if your setup is correct do the following:
add a background color to your window
self.window.backgroundColor = [UIColor whiteColor];
make sure you tell the window to display itself
[self.window makeKeyAndVisible];
make sure your view controller is the window's rootViewController
self.window.rootViewController = myViewControllerInstance;
Choose Single View Application, and uncheck 'Use storyboards" field. The rest should go the same.

Resources