In Cocoa, the Model-View-Controller pattern, a controller’s responsibility is to keep the view and the model synchronized. There are two parts to this: when the model object changes, the views have to be updated to reflect this change, and when the user interacts with controls, the model has to be updated accordingly.
Key-Value Observing helps us update the views to reflect changes to model objects. The controller can observe changes to those property values that the views depend on.Read on →
All the attributes of a property defines how the compiler generate the
- atomic / nonatomic
- strong / weak: used for ARC.
- assign / retain / copy: go to here for reference. These properties define how the compiler generate the
- readonly / readwrite: if a property is declared as
readonly, the compiler will only declare the getter accessor, so that you can not call setter accessor.
Location Service Authorization
1. Set info.plist
For iOS SDK 8.0 and later, we need to set
NSLocationWhenInUseUsageDescription and ‘NSLocationAlwaysUsageDescription’ in info.plist file. A sample case is:
1 2 3 4
string will appear in the popup dialog. You can leave it as empty, and only the system message will appear in the popup.
Write your own overlay class (for example,
MapOverlay) confirm to
boundingMapRect, so that we can assign value to them while initializing it.
Note that the type of
MKMapRect. And we need to use
MKMapPointForCoordinate method to convert a
CLLocationCoordinate2D type data to
MKMapPoint type data. If we assign the
CLLocationCoordinate2D data directly to
boundingMapRect, the overlay will be too small to draw, and the
mapView:rendererForOverlay: method will not be called at all. It is very hard for debugging.
[updated 2015.09.13] This adding method is only for my project pages (gh-pages) GitBlogs, and for octopress, the way is builded in.
[updated 2015.06.07] For adding category or tag automatically through python script, go to here.
The index page includes cat_tag_for_index.html for showing all the categories and tags, and the number of the corresponding posts.
The _layouts/default.html describes the content of a post, because post includes it. In the _layout/default.html file, it includes the cat_tag.html template as the category and tag info in the beginning of the post. And cat_tag.html also includes the date behind.
_data/categories.yml and _data/tags.yml describe all the categories and tags.Read on →
[updated 2015.10.30] The followings ways for deploying posts is deprecated. Refer to deploying octopress for details. But if you knows things this post descripbes, you will have better understanding of octopress.
[updated 2015.09.13] Github has two kind of pages: user/orgnization pages and project pages (gh-pages).
Currently, I am using the user/orgnization pages deployed by octopress. This is recommended, due to the easy deployment.
If you are using the project pages (gh-pages), the following references may be help.
How to get started
Refer to “一步步在GitHub上创建博客主页”.
Categories and tags
I tried the this one. It works well.
I didn’t try the debugger yet.
[updated 2015.10.30] The following way is for my previous blog, and now I am using octopress for my blog.
The following is for my project pages (gh-pages) GitBlogs.
The python script is put GitBlogs/tools/add.py.
For adding category or tag:
- go to tools/
python add.py -category category_nameor
python add.py -tag tag_namefor adding category and tag respectively.
Vim is an editor to create or edit a text file.
- command mode: move around, copy and past
- insert mode: insert text
- To add a new post
- To add a new “category” or “tag”
- To enable code highlight
- To make the post searchable by Google
- Some tips for markdown grammar
The first two sections are only for my project pages (gh-pages) GitBlogs, and currently in cotopress blog, we have other new simpler ways to do these things. See Migrate Blog to Octopress.
This post is not for how to deploy the environment of writing posts in github pages, but how to use the environment you deployed before.Read on →
Start Developing in a New Mac Machine
[updated on 2015.9.17] With Xcode 7, we only need an Apple ID for deploying your app to ipad or iphone, with the ability to debug.Read on →
Define a function addTimer, to log executed time for all function-type property of an object