This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Is it possible to change the title of PKAddPassesViewController ?
Hello, when I add a passbook I used coupon style:
pass = [[PKPass alloc] initWithData:data error:&error];
PKAddPassesViewController *vc = [[PKAddPassesViewController alloc] initWithPass:pass];
[vc setDelegate:(id)self];
[self presentViewController:vc animated:YES completion:nil];
the UIBarButtonItem have three button:“Cancel” ,“Coupon” “Add”
the “Coupon” is default, because I used coupon style, and I want to modify it.
I used vc.title=#"new Title" but this does not work.
No, it is not possible to modify the title text.
See this question Is it possible to change the title of PKAddPassesViewController ?
Related
This question already has an answer here:
New Xcode version 11.2.1 build app layout problem [duplicate]
(1 answer)
Closed 3 years ago.
View Controller status bar is overlapping in new iPhone like ios 8 When it's redirecting to another view controller , existing view screen status bar is displaying partially. I am using this code to redirect
SecondView *view = [[SecondView alloc] initWithNibName:nil bundle:nil];
[self presentViewController:view animated:YES completion:NULL];
This is not bug of status bar, this is feature of iOS 13, If you don't want this than you can set modalPresentationStyle to fullscreen. Like,
SecondView *view = [[SecondView alloc] initWithNibName:nil bundle:nil];
view.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:view animated:YES completion:NULL];
I'm currently implementing an iOS app using objective-C, which has a function that users may share a file with other friend or other app (like upload the file to Dropbox, Google Drive, attach the file to Mail, share the file to Facebook Messenger, Whatsapp, via Bluetooth, etc).
Is there a native way to implement this share function that can detect all apps which allows sharing a file, while I don't need to do it one by one?
You want to use UIActivityViewController. Below is an example from NSHipster, which is probably the most comprehensive article I've seen on the subject. And Apple has some good documentation here.
NSString *string = ...;
NSURL *URL = ...;
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:#[string, URL]
applicationActivities:nil];
[navigationController presentViewController:activityViewController
animated:YES
completion:^{
// ...
}];
This provide full answer for iPhone and iPad devices
ViewController *contentViewController = [[ViewController alloc] init];
// Present the view controller using the popover style.
contentViewController.modalPresentationStyle = UIModalPresentationPopover;
[self presentViewController:contentViewController
animated:YES
completion:nil];
// Get the popover presentation controller and configure it.
UIPopoverPresentationController *presentationController =[contentViewController popoverPresentationController];
presentationController.permittedArrowDirections = UIPopoverArrowDirectionUp;
presentationController.sourceView = self.view;
presentationController.sourceRect = self.view.frame;
UIPopoverPresentationController should have a non-nil sourceView or barButtonItem set before the presentation occurs on iOS 9
I have been searching for almost 2 hours on how to implement UIPopoverController in swift language, at the end, i found out that this api are exclusive for iPad devices only.
How will i be able to make a drop down list on iPhone devices?
please someone help me, at lease with the name of the api so that i know what to search for
You can you third party libraries for that:
FPPopover
WEPopover
or if you don't need iOS 7 support you can use iOS 8 new API which answered in this question
UIPopoverPresentationController on iOS 8 iPhone
i depends on your needs. You can show UIPickerView, present an action sheet or segue to another VC and then go back - these are standard ways.
#property(nonatomic,retain) UIPopoverPresentationController *popoverPresentationController;
- (IBAction)showPopover:(id)sender {
UIViewController *popoverViewController = [[UIViewController alloc] initWithNibName:#"NameViewController" bundle:nil];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:popoverViewController];
popoverViewController.preferredContentSize = CGSizeMake(280, 200);
navigationController.modalPresentationStyle = UIModalPresentationPopover;
_popoverPresentationController = navigationController.popoverPresentationController;
_popoverPresentationController.delegate = self;
_popoverPresentationController.sourceView = self.view;
_popoverPresentationController.sourceRect = [sender frame];
navigationController.modalPresentationStyle = UIModalPresentationPopover;
navigationController.navigationBarHidden = YES;
[_viewController presentViewController:navigationController animated:YES completion:nil];
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to develop a popover in my iPad application. A UIButton trigger will call the popover and that popover will contain a UITableViewController.
First I need a popover.
Need some example code or direction or link.
Thanks in advance.
in your viewcontroller on the button action write this code:
- (IBAction)openAllRhymes:(id)sender{
UIButton *button = (UIButton*)sender;
PopupTableView *tableViewController = [[PopupTableView alloc] initWithStyle:UITableViewStylePlain];
popover = [[UIPopoverController alloc] initWithContentViewController:tableViewController];
[popover presentPopoverFromRect:CGRectMake(button.frame.size.width / 2, button.frame.size.height / 1, 1, 1) inView:button permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[tableViewController release];
}
Now you have created a tableview for popover in that tableviewcontroller write:
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(108,400);
Read the documentation, it's all in there. If you don't understand it, start with general tutorials on iOS development or ask specifically about the parts you don't understand. You will need a solid understanding of how view controllers work before it makes sense to work with popovers. The View Controller Programming Guide also has a section specifically about popovers.
TAableViewController *tableViewController = [[[TAableViewController alloc] initWithNibName:#"TAableViewController" bundle:[NSBundle mainBundle]] autorelease];
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:tableViewController];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:nav];
[nav release];
popover.delegate = self;
popover.popoverContentSize = CGSizeMake(320, 497);
[popover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Here in this :-
1) TAbleViewController has the table you want to load .
2) i am adding this to the navigation controller
3) navigation controller to the popover
I am new at the area of Objective-C and am building an iphone app using Xcode. I have taken two buttons on a page and from among one I would like to go to another page. How is it possible at Xcode?
You can try it.
EnterNameController *newEnterNameController = [[EnterNameController alloc] initWithNibName:#"EnterNibFileName" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:newEnterNameController animated:YES];
EnterNameController *newEnterNameController = [[EnterNameController alloc] initWithNibName:#"EnterNibFileName" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:newEnterNameController animated:YES];
[newEnterNamecontroller release];
This one is more accurate as far as i know.
This type of thing is a basic building block of iPhone apps, and Apple provides plenty of sample code that shows how to do it.
Start by looking at the UICatalog sample project.
Get the book "Beginning iPhone Development" and go through it from start to finish without skipping anything.
You can try
TwoViewController * twoVC = [[TwoViewController alloc] init];
[self.navigationController pushViewController:twoVC animated:YES];
"TwoViewController" is a custom UIViewController