Hope is a good thing.

1月 2009 からの投稿

Image scaling is not supported on Mac OS X versions prior to 10.5

01/04/2009 · コメントを書く

ヒレガス本のサンプルを作成していたら、
Image scaling is not supported on Mac OS X versions prior to 10.5
というコンパイルエラー(正確にはwarning)が発生。

ググってみたところ、

というのが見つかった。

Scaling属性がProportionally Downになっているのが原因らしい。
どうも10.5からNSButtonに追加された属性のようで、10.4以下をデプロイ環境として含めるとエラーになる。
しかも、そんな属性値がデフォルト値として設定されているのが問題。

ただ、ヒレガス本のサンプルをダウンロードしてソースを見ても、ボタンのScaling属性がProportionally Downになっていて、試しにコンパイルしてもエラーが発生しない。
不思議に思ってよくよく見てみるとボタンの種類がヒレガス本のサンプルはRounded Textured Buttonで、自分のはGradient Buttonだった。
つまりボタンの種類で影響が出たり出なかったりするらしく、Gradient Buttonの場合にエラーが発生した。

ということで、ボタンの種類はGradient ButtonのままでScaring属性をNoneにしたらアラートは出なくなりました。

カテゴリー: Mac · Programming
タグ: ,

Today’s memo

01/03/2009 · コメントを書く

p.154

Archiveing involves two steps.
First, you need to teach your objects how to archive themselves.
Second, you need to cause the archiving to occur.

A protocol is a list of method declarations.
One protocol is NSCoding.
An NSCorder is an abstraction of a stream of bytes.

p.158

NSData is essentially a buffer of bytes.

カテゴリー: Mac · Programming
タグ: ,

Today’s memo

01/02/2009 · コメントを書く

p.119

Attribute of a property

the declaration of a property

@property (attributes) type name;

The attributes can include readwrite(the default) or readonly. A property marked readonly gets no setter method.

To describe how the setter method should work, the attributes can also include one of the following: assign, retain, copy.

- assign(the default) makes a simple assignment happen. assign does not retain the new value. If you are dealing with an object type and you are not using the garbege collector, you probably don’t want assign.
- retain releases the old value and retains the new value. This attribute is used only for Objective-C object types. If you are using the garbage collector, assign and retain are equivalent.
- copy makes a copy of the new value and assigns the variable to the copy. This attribute is often used for properties that are strings.

The attributes can also include nonatomic.

p.142

When designing a class, I tend to think of my instance variables as having one of four possible purposes:

1. Simple attributes.
- Simple attributes are typically numbers or instances of NSString, NSDate, or NSData.
2. To-one relationships.
- To-one relationships are implemented using pointers: An instance of Student has a pointer to an instance of School.
3. Ordered to-many relationships.
- Relationships of this kind are typically implemented using an NSMutableArray.
4. Unordered to-many relationships.
- This order is typically implemented using an NSMutableSet.

p.145

- Key-value cording is a way to read and change a variable’s value by using its name.
- Key-value observing allow you to be informed when these sorts of changes occur.

カテゴリー: Mac · Programming
タグ: ,

Today’s memo

01/01/2009 · コメントを書く

p.57

Conventions for Creating Initializers
- You do not have to create any initializer in your class if the superclass’s initializers are sufficient.
- If you decide to create an initializer, you must override the superclass’s designated initializer.
- If you create multiple initializers, only one does the work -the desinated initializer. All other initializers call the designated initializer.
- The designated initializer of your class will call its superclass’s designated initializer.

p.73

Rules Concerning Release
- Objects created by alloc, new, copy, or mutableCopy have a retain count of 1 and are not in the autorelease pool.
- If you get an object by any other method, assume that it has a retain count of 1 and is in the autorelease pool. If you do not wish it to be deallocated with the current autorelease pool, you must retain it.

Temporary Objects
- the autoreleased object won’t be released until the event loop ends;

p.79

AppKit framework
A control has a target and an action.
- The target is simply a pointerto another object.
- The action is a message(a selector) to send to the target.

p.90

- The action of a control is a selector.

カテゴリー: Mac · Programming
タグ: ,