Google Maps APi for iOS: UIActivityView on custom info window - iphone

I'm trying to put a spinner inside a custom info window that appears when the user presses a marker. I have a custom view for the window that has lots of subviews that show up fine. But when I try to add a UIActivityView or an animated PNG sequence, that doesn't show. Has anyone else experienced this?

The documentation on the mapView:markerInfoWindow: method says:
If you change this view after this method is called, those changes
will not necessarily be reflected in the rendered version.
It seems likely that the Google map is not showing the actual UIView you return, but a screenshot of it taken when the info window is returned by the delegate.
As mentioned in this answer, this is made explicit in the Android documentation - it seems likely that the Android and iOS SDKs work similarly.
If you've changed the view I'm not sure if there is a way to force the SDK to take a new screenshot of it. Possibly you could try setting the map's selected marker to nil and then back to your marker, to see if it then calls mapView:markerInfoWindow: again - although it might also re-centre the marker on the map when you do that. It also likely wouldn't be very efficient.

You can call mapView:markerInfoWindow: then inside the method you can create a UIView which you can add different controls on that UIView including the spinner. You can also specify on which location you would like to put the defined control.

Related

NSPopover to start in a detached state

Is there a way to force the NSPopover to start in the detached state? I only see isDetached which is a read-only property for the state of the popover and an NSPopoverDelegate method detachableWindow(forPopover:) which lets me override the window that gets created. I'd like to essentially click a button and have the NSPopover start in the state in this photo.
The style of this window is exactly what a product requirement is and I can't seem to find any NSWindow style settings that would make a window do something like this (nor an NSPanel)
This detached popover functionality seems special in that it:
non-modal, but stays above main app. Able to still interact with the main app just like in Messages how you can still click around and type a new message.
Clicking another app, AppFoo, puts both the main app and the helper window behind AppFoo.
The helper window can be moved around and isn't hidden on app deactivation (another app gets selected).
Has the little, native, grey X in the top left.
If you don't mind calling private API, it's actually pretty simple:
let detach = NSSelectorFromString("detach")
if popover.responds(to: detach) {
popover.perform(detach)
}
No need to even add a delegate. I don't know when this private method was added but it's available at least since macOS 10.13. I suspect it's available since the introduction of NSPopover, though.
Here is the trick.
Use the required delegate method detachableWindowForPopover: to do the work for you, like:
- (void) showPopoverDetached
{
NSWindow* detachedWindow = [self detachableWindowForPopover:nil];
[detachedWindow.windowController showWindow:nil];
}
Seems that the Apple engineers implemented detachableWindowForPopover: on a pretty smart way, I guess it uses the content view controller class, and will always create a singleton like instance of the detached window.
Once detachableWindowForPopover: has called the presented window instance will be re-used no matter when and why it is called, called it directly (from a func like my sample above) or indirectly (e.g. when you drag out, detach, the popover from its original position)
This way they can prevent a popover from being detached 'twice' and we can also implement the detached way programmatically, nice job from them!
Here is a tiny demo of how it works in a real life (tested on macOS 10.13 - 13.0)
https://imgur.com/a/sfc7e6d

Anyone implemented/used Mobile Device Screen Orientation plugin?

Has anyone successfully implemented screen orientation plugin in Sitecatalyst to capture mobile device orientation?. When we use the below code in the s_code, in the web page i am seeing some unusual behavior(ie: when we scroll the page to the bottom and then if i click anywhere on the content section, page goes to the top by default). I understand, that's happening because of this line "window.scroll(0,0)". Any help or thoughts?
Plugin Code below:
function screenOrientation(){switch(window.orientation){case 0:case 180:return("Portrait");break;case 90:case -90:return("Landscape");}window.scroll(0,0)}
Reference: [http://webanalyticsland.com/sitecatalyst-implementation/capture-mobile-device-screen-orientation-in-sitecatalyst]
Thanks in Advance.
This is clearly a code bug (or more a typo I think) and the line window.scroll(0,0) can be safely removed from the 'plugin' (its not really a plugin, just a js function that returns the orientation).
The reason this fires every time a user clicks on anywhere on the page is because you have ClickMap functionality enabled in your s_code.js configuration. This will fire an s.tl() everytime a click event occurs. the s.tl() will call the screenOrientation() function to populate your required prop/eVar.
So if you were to turn off clickMap (s.trackInlineStats=false;) this random scrolling to the top would stop even if you didn't remove the offending line. That said, remove the scrolling code, its not right or required!

How to Extract the information about UI elements during runtime of an iOS application?

Is there any way that one could extract the information about UI elements (of the UIView) from the application’s memory during runtime of an iOS application (iPhone). Like getting a reference to the current UIView element and find a way to enumerate all UI elements contained in that view and create an abstract graph of the UIView calls of the app dynamically?
Since it looks like you may be interested n some general suggestions, I'll give you this one: look at DCIntrospect (available on github, with good documentation).
With this open source software, you can examine any item in your UI that subclasses UIView. You can see its many properties in your console.
It is very easy to use. I tried it, and it was a very simple add to my application delegate. To enable it, you press the space bar on your keyboard.
Since it is open source, you can examine the code and see for yourself what UI element properties are available and even make changes yourself.
UIView comes with an undocumented function to do that: -recursiveDescription. It's not as pretty as DCIntrospect, but you don't have to add anything to your project. Simply do:
NSLog(#"%#", [view recursiveDescription]);
or you can call it from the debugger:
p [view recursiveDescription]
See Apple's Technical Note 2239 (scroll to the bottom) for more details, and other interesting debugging commands.

How do I add a button to the InAppSettingsKit setting view (iPhone/iPad)?

I have been looking at the sample app provided by InAppSettingsKit and I noticed the use of a couple of buttons:
I would like to integrate a single red button in my app called reset, however I'm not sure how to do it. I've had a look at the code in the sample app and I'm a bit lost with it all. Please could someone help me out?
After spending a while searching through all the code and plists I managed to find the answer to my question. For those who are interested what you need to do is the following:
Add a row to your Root.plist file with the Type set to IASKButtonSpecifier.
Set the Identifier on this row as something useful e.g. 'myButton1'.
Add the following delegate method to the viewController you loaded the InAppSettingsKit from:
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key
{
if ([key isEqualToString:#"myButton1"])
{
// Do some actions...
}
}
It's worth noting that the key is equal to the identifier you set in the Root.plist.
The only thing I haven't worked out yet is how to change the colour of the button; however I suspect this may be possible by overriding a method.
Great that you already found part of the solution. To customize the look, you should create a custom view using the IASKCustomViewSpecifier documented on http://www.inappsettingskit.com/. The yellow icon for instance is making use of this. In your case, you could return an instance of UIButton with a red background color (or a custom background image).
In this case, you don't need the buttonTappedForKey method to get the tap event but configure the target/action of your button as usual.

How to implement iPhone TitleBar in Android

You know in iPhone, The four components of a typical iPhone application are
a title bar,
a navigation list,
a destination page,
and a button bar.
for The Title Bar
The title bar includes the following elements:
Back button:
Screen title:
Command button:
My question comes, although i can use UI framework tool, such as:
Phonegap,
iui,
jtquery
to develop web app, but i can't display the TitleBar effect in Android,
i can't use below code in Android:
meta content="yes" name="apple-mobile-web-app-capable"
Actually, the above can work in Apple Safari Browser, but I can't use Safari to display our Android Project, which is i don't want to see.
Does anyone know how to fulfill this effect in Android, please help me, your help will be great appreciated.
to
"It's unclear if you developing a native android application or a webapp.
– alexanderblom yesterday"
sorry that i forget to mention, i want to develop a iphone-webapp-style application in Android. Since it's too difficult, i want to use iWebkit, but it seems only work in apple iPhone OS or Safari which contain the specific engine to display the beautiful layout, like below:( -_-! i am new so i can't post images here)
(source: appshopper.com)
If I'm not mistaken, if you want to custom in any way the title bar at the top of your screen, you have to do several things :
First, read this thread about titlebar customisation, as it's quite detailled.
Then, you have to add a few more things to it to match your requirements, all in the same xml file which will be your titlebar.xml:
-a button, on which listener you assign the same keyEvent as the normal back key of every android phone.
-a textview for whatever title you want to put in.
-a button for the command button, for whatever it does in Iphone (if you tell me what it does, maybe i'll be able to give more details)
Then, as I take it, you want to have it available on all your pages, without having to request titlebar customization on every activity, I would recommend you to use the same trick as I did : Define a superclass, which all your activities will extend.
then you you requestwindowfeatures in this class, and do all your customization in this one.Finnaly, You just have to call the variable of your titlebar textview in the oncreate of all your subclasses to assign the string you want on each page. If your string is generated dynamically from, lets say a file name you load from the internetv in a background thread, you will need to define a handler to the main thread as you can't update a view from another thread than the one that has created it.
Hopes that helps. If you have any question about that, feel free to ask, i'll keep an eye on your topic, because I had quite a pain to make my titlebar work properly.
good luck