inAppbrowser done button text change - ios

in my phonegap iOS app, i m using cordova2.7.0 and using inAppwebbrowser, when it opens done button coming to bottom, i need to chnge text of 'Done' to french name, so please tell me.
Thanks

You can do it by native in Xcode ,in phonegap currently can't do it, customizing 'Done' button text is a feature that the Phonegap team is working on. You can read more about it here.
how in xcode:
Locate CDVInAppBrowser.m as shown
coredovalib -> classes -> commands -> CDVInAppBrowser.m
and paste below code snippet where close button properties are set
self.closeButton = [[UIBarButtonItem alloc] initWithTitle:#"my text"
style:UIBarButtonItemStyleBordered target:self action:#selector(close)];

Try this
On CDVInAppBrowser.m file replace
Replace this
if (browserOptions.closebuttoncaption != nil) {
[self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
}
to
if (browserOptions.closebuttoncaption == nil) {
NSLog(#"hiii if");
[self.inAppBrowserViewController setCloseButtonTitle:#"Your French Name hear"];
}

Open ${projectname}/plugins/org.apache.cordova.inappbrowser/src/ios/CDVInAppBrowser.m with an editor of your choice.
in the init function, look for this:
self.toolbar = YES;
self.closebuttoncaption = nil;
self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
self.clearcache = NO;
self.clearsessioncache = NO;
Change
self.closebuttoncaption = nil; => self.closebuttoncaption = #"your text";
The Main advantage here is that it builds correct and you don't have to change it every time you build.
Also it is recommend to change the text in the init function, so don't have to change it in the setter function.
P.S.: Im using org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"

In Cordova InAppBrowser 1.7.0 you can supply the close button text as closebuttoncaption when calling the InAppBrowser rather than having to change the code of Cordova:
myIAB.create('http:/blah, '_blank', 'location=no,closebuttoncaption=Close');
And also in window.open:
window.open('http://blah','_blank','location=no,closebuttoncaption=Close');
Other browserOptions listed in CDVInAppBrowserOptions with the defaults:
location = YES;
toolbar = YES;
closebuttoncaption = nil;
toolbarposition = kInAppBrowserToolbarBarPositionBottom;
clearcache = NO;
clearsessioncache = NO;
enableviewportscale = NO;
mediaplaybackrequiresuseraction = NO;
allowinlinemediaplayback = NO;
keyboarddisplayrequiresuseraction = YES;
suppressesincrementalrendering = NO;
hidden = NO;
disallowoverscroll = NO;

Related

I can't see my siri shortcuts on lock screen using NSUserActivity

I add on the info.plist my strings with the tag NSUserActivityTypes.
I add this piece of code on the viewDidload method of the screen:
NSUserActivity *userActivityTag = [[NSUserActivity alloc] initWithActivityType:kVoucher];
if(#available(iOS 12.0, *)) {
[userActivityTag setEligibleForPrediction:YES];
userActivityTag.suggestedInvocationPhrase = [NSString stringWithFormat:#"Let's Voucher this"];
}
[userActivityTag setEligibleForSearch:YES];
[userActivityTag setRequiredUserInfoKeys:nil];
userActivityTag.title = [NSString stringWithFormat:#"Voucher"];
userActivityTag.userInfo = #{
#"value":#"key"
};
UIImage *logo = [UIImage imageNamed:#"someImage"];
NSData *logoNSData = UIImageJPEGRepresentation(logo, 1.0f);
CSSearchableItemAttributeSet *attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType: (NSString *)kUTTypeItem];
attributes.title = #"title";
attributes.keywords = #[#"implement", #"something", #"lol"];
attributes.contentDescription = #"Subtitle";
attributes.thumbnailData = logoNSData;
attributes.domainIdentifier = #"ownID";
userActivityTag.contentAttributeSet = attributes;
[userActivityTag becomeCurrent];
After that I go to that screen and puts a breakpoint in order to probe that the code was executed.
I switch on both options on Settings -> Developer -> Display recent Shortcuts and Display donations on Lock Screen.
On my AppDelegate I had this:
if([userActivity.activityType isEqualToString:kVoucher]) {
// Restore state for userActivity and userINFO
}
So, the question is: Why, I canĀ“t see my shortcut on the lockscreen?
Any help please!
Are you able to see it when you unlock the phone and go to siri suggestion screen?
Try setting this activity to your current view controller.
[self setUserActivity: userActivityTag]
Don't know it will help or not but its working for me.

ios remote keyboard window

In iOS 9, I see a new window appearing in my app that I didn't see before. An image is below. From walking the view tree, I suspect it may be coming from the UIRemoteKeyboardWindow -- but I don't know that. What is it, and what do I have to do to keep it from appearing?
EDIT: As a commenter pointed out, this is tied to the inputView, i.e. the keyboard. I don't want a keyboard and so disabled it by calling
self.inputView = [[UIView alloc]initWithFrame: CGRectZero];
That did kill the keyboard, but there is still the accessory. I've tried similar tricks to kill the accessory; none of them have worked, yet. Calling self.inputAccessoryView is returning nil, which doesn't help.
This got rid of it:
-(void) killAccessory {
UIView* input = self.inputView;
UIView* parent = input.superview;
parent.hidden = YES;
}
-(BOOL) becomeFirstResponder {
BOOL r = [super becomeFirstResponder];
[self killAccessory];
return r;
}
You can use the following code :
textField.inputAssistantItem.leadingBarButtonGroups = [[NSArray alloc] init];
textField.inputAssistantItem.trailingBarButtonGroups = [[NSArray alloc] init];
the textField use above is the textField which you tap to edit.

iOS esri sdk - Multiple Popups using AGSPopupsContainerViewController

I am using AGSPopupsContainerViewController to display multiple popups when touching on mapView we fetch more than one AGSGraphics.
Here is my code:
NSMutableArray *popups =[[NSMutableArray alloc]init];
AGSPopupInfo *popupinfo;
for (AGSGraphic *g in Graphics ) {
popupinfo =[AGSPopupInfo popupInfoForGraphic:g] ;
AGSPopup* popup = [AGSPopup popupWithGraphic:g popupInfo:popupinfo];
popup.allowEditGeometry = false;
[popups addObject:popup];
}
if (!popupVC) {
self.popupVC = [[AGSPopupsContainerViewController alloc] initWithPopups:popups
usingNavigationControllerStack:false];
}else{
[self.popupVC showAdditionalPopups:popups];
}
self.popupVC.delegate = self;
self.popupVC.doneButton = self.customActionButton;
self.popupVC.style = AGSPopupsContainerStyleCustomColor;
self.popupVC.barItemTintColor = [UIColor redColor];
self.popupVC.pagingStyle = AGSPopupsContainerPagingStyleToolbar;
// Animate by flipping horizontally
self.popupVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
// If iPad, use a modal presentation style
if([[AGSDevice currentDevice] isIPad])
self.popupVC.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:self.popupVC animated:YES completion:nil];
All works fine, I have the right number of pupups, the problem is that using the arrows in the toolbar I can only see the first and the last ones. Why? I am missing something?
Arrows are doing what they are supposed to do - using them will show you the first and the last popup. Swipe to the left (or right) and you'll see the rest of the popups.

Hide back button in MWPhotoBrowser navigationcontroller

I am using MWPhotoBrowser in my ARC project. Everything is working fine. I want to hide back button. In performLayout() function, I tried below code to hide back button but its not working.
self.navigationController.navigationItem.backBarButtonItem = nil;
or
self.navigationItem.backBarButtonItem = nil;
or
self.navigationItem.hidesBackButton = YES;
Any idea how to do this?
In MWPhotoBrowser.m find the following line:
self.previousViewControllerBackButton = previousViewController.navigationItem.backBarButtonItem;
and change it to:
self.previousViewControllerBackButton = nil;
#KingPolygon, #iOSDev.
As my account is short of minimum reputations to comment, so I am using this option.
I have done it same as you described but, backButton doesn't removed on my side.
//_previousViewControllerBackButton = previousViewController.navigationItem.backBarButtonItem; _previousViewControllerBackButton = nil;
I did above in -performLayout;

MTLocation how-to

Hi I just came across MTLocation here: https://github.com/darkseed/MTLocation.
I want to use a locate me button in my app which will be located in navigation bar and when pressed will move the map to current location.
The author proposes to use the code like this:
// Configure Location Manager
[MTLocationManager sharedInstance].locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[MTLocationManager sharedInstance].locationManager.distanceFilter = kCLDistanceFilterNone;
[MTLocationManager sharedInstance].locationManager.headingFilter = 5; // 5 Degrees
// create locate-me item
MTLocateMeBarButtonItem *locateMeItem = [[[MTLocateMeBarButtonItem alloc] initWithLocationStatus:MTLocationStatusIdle] autorelease];
// set delegate that is called when mode of Button changes
locateMeItem.delegate = [MTLocationManager sharedInstance];
// add target-action
[locateMeItem addTarget:self action:#selector(myCustomSelector:) forControlEvents:UIControlEventTouchUpInside];
// disable heading
locateMeItem.headingEnabled = NO;
// create array with ToolbarItems
NSArray *toolbarItems = [NSArray arrayWithObject:locateMeItem];
// set toolbar items
[self.toolbar setItems:toolbarItems animated:NO];
which is great to show a locate me button in toolbar but how can we make this work to show current location through gps? I guess tha we have to implement myCustomSelector method but I do not know how. Any help?
Make sure that you have
self.mapView.showsUserLocation = YES;
And then implement myCustomSelector:, for example like this:
- (void) myCustomSelector:(MTLocateMeBarButtonItem*) button {
[self.mapView setCenterCoordinate:self.mapView.userLocation.location.coordinate];
}
You'll need to take care of a proper functionality at different button modes (whether MTLocateMeBarButton is Idle, or something else), but that should give you a direction.

Resources