Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

Friday, November 8, 2013

"Pitch It" is Released


App Site: http://pitchit.nctucs.net/
Apple Store: https://itunes.apple.com/us/app/pitch-it-perfect-pitch-challenge/id736721019?ls=1&mt=8

I've been working on this app, "Pitch It", for around one month. This interesting work is cooperated with Shumin, who has brought out lots of beautiful design and being a great partner.

"Pitch It" is a note guessing game. It plays a music note and ask to the user to tell if he/she can tell which note it is. People define a person who have "absolute pitch" or "perfect pitch" if he/she can answer more than 70% of the questions. With this app, the app can tell if you have "absolute pitch" or not.

On the other hand, this app is fast-implemented. I wanted to see how the Apple Store distribution works. That was a little complicated, and take a long for app reviewing by Apple. There, I write done time when the state is changed of this app on iTunes Connect.
  • Sat, Nov 2, 2013 at 12:38 AM: turned to Waiting For Upload
  • Sat, Nov 2, 2013 at 01:18 AM: turned to Waiting For Review
  • Fri, Nov 8, 2013 at 06:32 AM: turned to In Review
  • Fri, Nov 8, 2013 at 07:58 AM: turned to Processing for App Store
  • Fri, Nov 8, 2013 at 08:45 AM: turned to Ready for Sale
It means that takes 6 days for "Waiting For Review" state, and less than two hours for them to review and release.

Friday, October 4, 2013

constraintsWithVisualFormat, the most interesting coding style I've ever seen

在WWDC 2012的演講中,介紹了auto layout,相對於其他文件,這關於排版的程式設計透過影片能比較快的學起來,其中最酷的是一個constraintsWithVisualFormat的函式,讓我們感覺到除了在裝置、界面設計上別出心裁的Apple,在開發者這端也有很有趣的設計。

Apple在iOS 5之後的開發平台上提供auto layout的功能,可以在點選storyboard點選某個view後,於右側的選單中開啓這功能(多已經預設),而constraints就是其中最重要的機制,不會複雜,說穿了,constraint就是一個一維線性代數(y = ax + b),裡頭的y和x分別是某個物件中的某個位置或長度,a和b就是個常數,於是乎,auto layout就是透過這些constraints對於物件擺放的敘述而排版,好的敘述會讓版面不論縮放、旋轉後都是好看的。

constraints可以用一般的函式一一輸入 y = ax + b,但是Apple在設計時候可能是發現這樣太麻煩了,一個constraint的函式表示要六、七行以上呢!所以提出Visual Format這樣的東西,是透過視覺化程式碼,對於喜歡ASCII Art的人的一大福音!

以下是WWDC 2012演講簡報中部分的內容,很酷!
視窗上的兩個button:

抓一下輪廓:

再抽象一點點:

程式碼就這樣出來了:




Monday, July 1, 2013

Delegate in iOS

My question is "what is delegation?" after writing several iOS programs.

"Delegation is a simple and powerful pattern in which one object in a program acts on behalf of, or in coordination with, another object. The delegating object keeps a reference to the other object - the delegate - and at the appropriate time sends a message to it. The message informs the delegate of an event that the delegating object is about to handle or has just handled. The delegate may respond to the message by updating the appearance or state of itself or other objects in the application, and in some cases it can return a value that affects how an impending event is handled. The main value of delegation is that it allows you easily customize the behavior of several objects in one central object."

Basically, "delegation" is way that one object communicate with the other object.

這網頁中的Example 1是一個很好的範例,講述有兩個object,為brain和beer bottle,brain可以不斷下達指令給beer bottle要喝,但是brain因為要看電視所以太忙沒有辦法知道什麼時候beer被喝完,於是乎,beer bottle此時就要用delegation,當沒有beer時告知brain。

而這網頁講述了delegation中物件的關係,若此時物件A call 物件B:

  • A是B的delegate object
  • B會有A的reference
  • A會implement B的delegate method
  • B可以與A communicate,用delegate methods

Reference:



Thursday, May 16, 2013

Matchismo on iOS



This is the first assignment for the course CS193P at Stanford 2013 winter session. It shows how the "MVC" structure works, and also includes really good coding style in objective-oriented programming.

http://www.stanford.edu/class/cs193p/cgi-bin/drupal/

Some interesting stuffs I would like to share is as below:

  1. Connecting the "View" related events or properties by dragging the object from GUI programming interface to text code. Cool.
  2. NIL pointer design, I've written things about this in last post.
  3. General initialisation design. Objects in objective-C mostly have the some usage in initialisations, setters/getters, function callings, etc. It's easy for the developers to learn some basic examples and apply on different occasions.
  4. Auto-complete editing design in Xcode. Although this feature, auto-complete while typing the code, is not new stuff, it's still the best auto-complete mechanism I've ever seen. It's fast, and smart. It allows you to jump to next blank in a very short time. While writing the program, you spent very little time on typing. Around 80%~90% of the code can be done by the auto-complete function, only the new names for object/function/etc are needed to be typed completely. At last, Xcode also generates those an annoying special characters in the code, like "", [], {}, etc.
Finally, the developing environment for iOS is not only including great designs but also so much fun.



Saturday, May 11, 2013

NIL Pointer in Objective C

In many programming languages, we do the checking if the pointer is null (equally, 0) or not before we start to grab the content. However, in Objective C, there's no need to do this. The design makes you no need to do so.

When a pointer has no object points to, it's automatically storing the value 0, which we call a NIL pointer. And, we can complete our other designs without checking the pointer is NIL or not because that function calls just do nothing on NIL pointers, and return 0.

Take one example I learned in the class,
if ([card.contents isEqualToString:self.contents] ){ score = 1; }
No need to card.contents is NIL or not. If it's NIL, isEqualToString just simply skip it and return 0, which may cause the if-statement failed, which is also the right thing we want.