19
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

iOS 64bit対応ではまったところ (書きかけ)

Last updated at Posted at 2013-12-11

NSInteger CGFloatなどの型

64bit環境では CGFloatはdouble型!

#if defined(__LP64__) && __LP64__
# define CGFLOAT_TYPE double
# define CGFLOAT_IS_DOUBLE 1
# define CGFLOAT_MIN DBL_MIN
# define CGFLOAT_MAX DBL_MAX
#else
# define CGFLOAT_TYPE float
# define CGFLOAT_IS_DOUBLE 0
# define CGFLOAT_MIN FLT_MIN
# define CGFLOAT_MAX FLT_MAX
#endif

typedef CGFLOAT_TYPE CGFloat;

あるところで

 - (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

と書くべきところを

 - (float) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

と書いていただけで、ヘッダーの高さがすべて0に...

#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif

同様にNSIntegerlongになっています.

int index = [someArray indexOfObject: someObj];
if ( index !=  NSNotFound) { ... }

( index != NSNotFound) は常にtrueになるので注意が必要.

objc_msgSend()はタイプキャストしないといけない

19
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?