I am trying to create an Appcelerator IOS module, basically its a conversion of an App in Native to Appc module.
The Native Project has been created using XIBs.
So far i created a Proxy and used that view proxy to fetch the XIB using
[[ViewController alloc] initWithNibName:#"ViewController" bundle: bundle];
I have converted the xibs to Nibs and have put them in the Asset folder of the Project invoking the module.
By doing all this i have been able to render the ViewController screen.But no events are working on this screen.
Here is the code rendering the second xib :
- (IBAction)handleStinkyClick:(id)sender {
firstScreen *fs=[[firstScreen alloc]initWithNibName:#"firstScreen" bundle:nil];
fs.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
[self presentViewController:fs animated:YES completion:nil];
}
Is there anything i am missing?
Any help will be appreciated.
I will ask an iOS engineer of use to have a look, but you might be interested in trying out Hyperloop for iOS, which lets you require XIBs and mix and match Ti.UI.View and native code.
http://labs.appcelerator.com/project/55f74a9f421c44837717716b/Hyperloop-Module
Related
I am in the midst of creating a Cordova camera plugin. I know there are many alternatives out there, but none of them have all of the functionality that I am looking for, or they are outdated.
So I have been working with the AVCam-iOSUsingAVFoundationtoCaptureImagesandMovies project that Apple provides to get you started with their AVFoundation library.
After working with the library a bit, I realized that I wanted to make it into a Cordova plugin, but the only thing that I am concerned about is the UI functionality of the plugin. So I am wondering if it is possible to include the storyboard files (that render the view / buttons) in the Plugin, so that they work seamlessly, or if it needs to be programmatically created, like other Camera plugins (like CameraPreview) do.
Yeah, you can add a storyboard to a plugin.
First add the storyboard in the plugin.xml
<resource-file src="src/ios/YourStoryboard.storyboard"/>
Then in the code you can get the initial view controller like this:
UIStoryboard* sb = [UIStoryboard storyboardWithName:#"storyboardName" bundle:nil];
UIViewController * vc = [sb instantiateInitialViewController];
I need to download a file from api like
http://52.76.226.179/aapc-social-web/sites/default/files/media_docs/2009/content-601938936.ppt
and display a preview of that in my ios app.
Please help.
I have used the quick look framework and UIDocumentInteractionController show me something like this. please see the image and suggest something.
import this pkg
#import <QuickLook/QuickLook.h>
Use this code in View controller.
QLPreviewController *previewController=[[QLPreviewController alloc]init];
previewController.delegate=self;
previewController.dataSource=self;
previewController.view.frame = self.conditionsofUseView.bounds;
[self.conditionsofUseView addSubview:previewController.view];
[self addChildViewController:previewController];
[previewController didMoveToParentViewController:self];
[previewController.navigationItem setRightBarButtonItem:nil];
Add These Delegate methodes
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller
{
return 1;
}
- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"docFileName" ofType:#"file type"]; //doc,ppt,pdf etc
return [NSURL fileURLWithPath:filePath];
}
[UIDocumentInteractionController][1] Is what you are looking for.
The main difference respect QLPreviewController, is that it can display a preview and also it can display a UiActionSheet or popover showing the applications compatible with that format and delegate the display of the document to them.
It's super easy to use it. Check here
.
If you just want to view the Office files, have a look at:
Document Interaction Programming Topics for iOS: Quick Look Framework.
Quick Look Framework Reference
Quick Look Framework supports a lot of file formats as you can see in the links above. It is available in iOS 4.0 and later.
You can also use UIWebView to display them. See Using UIWebView to display select document types.
I've read many other questions about this but didn't find a solution right now and my issue is perhaps a little more specific than what I could see elsewhere.
So currently I build a static library including some other frameworks, a bundle with graphic resources + storyboard and subclasses of UIViewController assigned in "Class" field of my storyboard's view controller.
When I use my lib in a test project, it seems I can load the view controller from storyboard but I crashes with "unrecognized selector sent to instance" once I press any control in the view.
Also Xcode reports : "Unknown class CustomViewController in Interface Builder file." before.
Here is the code I'm using to load it:
NSBundle *bundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:#"careersbundle" withExtension:#"bundle"]];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self.window setBackgroundColor:[UIColor blueColor]];
self.sb = [UIStoryboard storyboardWithName:#"MainStoryboard_iPad" bundle:bundle];
self.vc = [self.sb instantiateViewControllerWithIdentifier:#"Player"];
[self.window setRootViewController:self.vc];
//...
As I understand, I don't need to reference any .h file in includes as my project only needs to load the ViewController and it should then work on his own with IBAction.
I see that setting project's "Other Linker Flag" to -ObjC should help but dosen't solve my issue. I set this flag in my library project (not the test project) but I'm not sure I'm doing it right like this ?
I also see developers using "[CustomViewController class]" to force linker to keep reference to class but they use it in main.c and I didn't have a main.c in my library project...
I'm lost with this, can someone point me to settings I have to do in the library project and then in my test project to make it works.
Thanks
I finally implemented the complete interface in code using nib2objc tool to convert my storyboards views's properties in code.
I am relatively new to iPhone development.
When I open Xcode, my object library palette contains an "Address Book People Picker View" and other objects that disappear when I select a .xib file. This seems to be consistent with the behavior mentioned here: XCode Developer API - Object Library - Objects Disappearing
The above answer suggests that the Xcode palette is initially populated with all iOS and Mac objects, but then amends the list appropriate to the target when the XIB file is selected. I thought that the AddressBook framework/objects were supported in iOS so if only iOS objects remain then why are the AddressBook objects disappearing?
Thanks in advance
I don't believe you can use the AddresBookUi framework objects in Interface Builder, but must instantiate them programmatically. Some of them used in specific ways to function correctly, for example ABUnknownPersonViewController must be embedded in a navigation controller.
Since many of these views cannot be used in a generic fashion they are not exposed in interface builder to prevent confusing users.
For example:
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
[picker release];
I have just downloaded the InAppSettingsKit and I'm trying to integrate it with my app however I'm having some issues with it since I can't find any documentation to help me out. So far I've done the following steps...
I added the InAppSettingsKit directory to my Xcode project.
I created a new UIViewController class for my settings (which I named settingViewController).
At this point I have become a bit stuck as I'm not sure what needs to be done. If someone could offer some steps on how to integrate this it would be really really helpful as I can't find any up to date documentation online.
Usually, you don't need 2. You just configure a button action to display IASKAppSettingsViewController. This could look like this (in this case for a modal presentation):
appSettingsViewController = [[[IASKAppSettingsViewController alloc] initWithNibName:#"IASKAppSettingsView" bundle:nil] autorelease];
appSettingsViewController.delegate = self;
appSettingsViewController.showDoneButton = YES;
UINavigationController *aNavController = [[[UINavigationController alloc] initWithRootViewController:appSettingsViewController] autorelease];
[self presentModalViewController:aNavController animated:YES];
Check MainViewController.m in the sample app for different ways to present it (navigation push, tabBarItem, etc.).