WMS with Google Maps on iOS

Screen Shot 2014-04-21 at 00.49.02Sample for using WMS sources in Google Maps SDK for iOS. available on github here: https://github.com/Sumbera/WMS_iOS_GoogleMapSDK
Provide your API key in the WMSController.h

  • Google Maps for iOS used : 1.7.2 (April 2014)
  • used XCode 5.1.1 (April 2014)
  • iPad Air, iOS 7.1 (should run in iOS6.0 too)

 

There are two ways of overlaying WMS in the Google Maps for iOS SDK:

“Method B”: use GMSTileURLConstructor

   // -- method B. WMS tile layer with GMSTileURLConstructor
      GMSTileURLConstructor urls = 
         ^(NSUInteger x, NSUInteger y, NSUInteger z) {
           BBox bbox = bboxFromXYZ(x,y,z);
           NSString *urlKN = 
             [NSString stringWithFormat:@"Your WMS url&BBOX=%f,%f,%f,%f",
                                           bbox.left,
                                           bbox.bottom,
                                           bbox.right,
                                           bbox.top];

          return [NSURL URLWithString:urlKN];
      };

“Method A”: use custom TileLayer derived from GMSTileLayer

  1. your derived class from GMSTileLayer (here WMSTileLayer.h) will receive tile request
     -(void)requestTileForX:(NSUInteger)x 
                                     y:(NSUInteger)y
                                  zoom:(NSUInteger)z 
                              receiver:(id<GMSTileReceiver>)receiver
    
  2. WMSTileLayer first checks for cached tile and if found calls :
      [self drawTileAtX:x y:y zoom:z Url:urlStr Receiver:receiver] ;
    
  3. if tile is not cached we download it, save it to the file system (using MD5 hash) and call to draw it
      [data  writeToFile: filePath  atomically:YES];
      [self drawTileAtX:x y: y zoom: z Url:urlStr Receiver:receiver] ;
    
  4. drawTileAtX is very simple:
      -(void) drawTileAtX: (NSUInteger) x 
                                   y:(NSUInteger) y
                                zoom:(NSUInteger)zoom
                                 Url:(NSString*) url
                            Receiver: (id<GMSTileReceiver>) receiver {
           UIImage             *image   = TileLoad(url,NO); 
           [receiver receiveTileWithX:x y:y zoom:zoom image:image]; 
      }
    

}

both ways are used in this sample.

From .NET to iOS developer

What it takes to transfer from Microsoft .NET to Apple iOS  developer ?

Update 2015: more longer and similar story/explanation  found  here

 

So this was me ‘before’ with all my friends:  Windows, C#, .NET, Visual Studio, MSDN :

transcript:
– easy ‘managed’ life,
– can smile and make ceremony
– implicit friends and friends of friends you can’t get rid of them
– shallow water, no deep dive
– few freezes
– slightly detuned, but good enough for many
– moon shots

…and me ‘after’  passing through the  fire of iOS, Objective-C, Cocoa Touch, XCode, Documentation, Mac, Certificates, AppStore

transcript:
– different game, different rules
– lot of explosive material (resources)
– focused, not distracted by ‘friends’
– intelligence and luck needed
– dangerous and too explicit
– very rewarding

 

 

Leaflet 0.7 vs. OpenLayers 3 beta 1 on iOS

leafol2Made quick test of these 2 +1 HTML5 renderers on iOS running inside iOS app in the WebView, that is without Nitro acceleration.  All run on iPad Air

Leaflet 0.7 : great , works fine, everywhere, doesn’t load while dragging map (on mobile only) , runs on Microsoft  Surface too.

OpenLayers 3 beta 1 : runs fine too, loads map during dragging, seems like smaller framerate, can over zoom OSM, doesn’t run in Microsoft Surface well.

Seznam Mapy Api v 4 – proprietary renderer from Seznam , bad rendering  on iOS, missing tiles, nice map sources

Videos and original web pages used: – screencasted by AirPlay – that is directly from iPad Air:

B. OpenLayers 3 beta1
C. Mapy Api v 4.8

Apple A7 faster than my desktop cpu

I am developing for iOS on 2.5  years old  white MacBook (mid 2010) which has a Geekbench3 64 bit  mutli core result of average 2395 (mac scores  ) This Mac is powered by  Intel Core 2 Duo P8600 2400 MHz (2 cores), runs quite well  as it has upgraded SSD disk  (OWC Mercury Extreme 6G) and 8GB RAM , now with Maverick OS X even better in performance  than previous OS X cats.

Now latest Apple A7 64 bit processor has scored  2564 in the same benchmark  posted here

So yes, Apple A7 is a desktop-class processor, that in my case could teoretically run instead of my current Intel CPU  to handle all development  tasks I do on daily basis.

here is a snapshot of my over-tableted working place.

Fotografie-0001

Links for iOS dev. fonts etc.

Fonts for iOS:

https://github.com/mediacabinet/fawe-ios
https://github.com/nschum/FontAwesomeIconFactory
https://github.com/waterlou/WTGlyphFontSet

Commnad Master:
https://github.com/asm09fsu/CommandMaster

Obj-C (ARC) in depth :
http://adcdownload.apple.com//wwdc_2011/adc_on_itunes__wwdc11_sessions__pdf/322_objectivec_advancements_in_depth.pdf

Safari on iOS& and HTML changes
http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review

Instantiate view on iOS with mix of XIB and View class

How avoided storyboard and overloading XIB with just right split between what is visually defined and what is programatically programmed:

  1. visual set-up of the view in Interface builder – only view, no controllers and setting up outlets but no actions. AddNoteView.xib . Justify controls, set up autoscaling etc..
  2. create AddNoteView.h with outlets
  3. create AddNoteView.m and hook awakeFromNib and setup additional settings on view- (void)awakeFromNib{

    [super awakeFromNib];

    CALayer * layer = [self.locationThumb layer];

    [layer setMasksToBounds:YES];

    [layer setCornerRadius:10.0];

  4. create AddNoteViewController.m and define loadView- (void)loadView {

    self.view =  [[UINib nibWithNibName:@”AddNoteView” bundle:nil]  instantiateWithOwner:nil options:nil][0];

    }

Menu on iOS with MJPopupViewController

IMG_2646

Searched a lot, didn’t want to program something that had to be part of the iOS, found lot of over-bloated components and found it finally here,  tiny (2 classes) , well written, easy to understand the code, fun concept (big button as background view to receive taps outside the control) :

Here is a snapshot of my testing code with UITableViewController using this lib, note transparency and special font used for menu:

https://github.com/martinjuhasz/MJPopupViewController

 

 

Screen Shot 2013-10-11 at 9.03.12 AM

Who is able to stuff a desktop-class software inside the smartphone ?

“Mike Lazaridis was at home on his treadmill and watching television when he first saw the Apple iPhone in early 2007. There were a few things he didn’t understand about the product. So, that summer, he pried one open to look inside and was shocked. It was like Apple had stuffed a Mac computer into a cellphone, he thought.

from: http://www.theglobeandmail.com/report-on-business/the-inside-story-of-why-blackberry-is-failing/article14563602/#dashboard/follows/

6 years later September 10th:  iPhone is featuring an all-new A7 chip, making iPhone 5s the world’s first smartphone with 64-bit desktop-class architecture for blazing fast performance in the palm of your hand.

 

who is able to stuff a desktop-class  software inside the desktop-classs CPU powered smartphone  ?

iOS7 notes

iOS7 transition guide (UI): https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/index.html

iOS7 std link problem:  found linking problem (only) on iOS7 , solution is to add libsstdc++ manually into the build phase – link as described here: http://stackoverflow.com/questions/18959691/ios7-only-stdlibc-linking-issue

Fix UI controller layout for iOS6 and iOS7:

http://www.mobinett.com/2013/08/19/ios7-ui-transition-porting-view-controller-layouts-ios6/

// -- hide status bar on iOS7  - add to controller:
 - (BOOL)prefersStatusBarHidden{
 return YES;
 }

-- not iOS7 related but useful: create cell view either from Nib or manually:
 //-----------------------------------------------------------
 -(CategoryCell*) createCell{
  static NSString *reuseId = @"CategoryCellIdentifier";
  CategoryCell *cell = [self.tableView dequeueReusableCellWithIdentifier:reuseId];
  if (cell == nil){
   cell =  [[UINib nibWithNibName:@"" bundle:nil] instantiateWithOwner:nil options:nil][0];
 //cell = [[CategoryCell alloc] initWithStyle:UITableViewCellStyleSubtitle  reuseIdentifier:reuseId] ;
  }
 return cell;
}

Notes on native vs. HTML apps

07-Josef-Lada--Detem This is like fox and stork story, deep or shallow, Native or Html. ( btw. the picture here is from Czech painter “Josef Lada”). As I am more ‘stork’ than fox, I have collected few resources for other ‘storks’ out there.

My understanding is that mobile platforms are ‘extension of the human senses’ and this trends continues with wearable computing devices, smaller, tighter in resources. Doesn’t matter what software you write, whether enterprise or consumer it is extension of us, our finger touch, eye view, near real time.

Stork links :

http://www.marcozehe.de/2012/12/10/why-do-native-mobile-apps-seem-to-win-all-the-time/

http://www.zdnet.com/heres-why-html-based-apps-dont-work-7000012942/

http://mobiforge.com/developing/blog/why-html5-still-presents-some-problems-mobile

http://boagworld.com/mobile-web/the-problem-with-mobile-frameworks/

http://sealedabstract.com/rants/why-mobile-web-apps-are-slow/

http://j15r.com/blog/2013/07/05/Box2d_Addendum