달력

10

« 2024/10 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

strUrl = [strUrl stringByAddingPercentEscapesUsingEncoding:-2147481280];

http://limechat.net/rubycocoa/wiki/?NSStringEncoding

NSStringEncoding

Tiger で使える NSStringEncoding の値を列挙してみました。

1 NSASCIIStringEncoding Western (ASCII) US-ASCII
2 NSNEXTSTEPStringEncoding Western (NextStep) X-NEXTSTEP
3 NSJapaneseEUCStringEncoding Japanese (EUC) EUC-JP
4 NSUTF8StringEncoding Unicode (UTF-8) UTF-8
5 NSISOLatin1StringEncoding Western (ISO Latin 1) ISO-8859-1
6 NSSymbolStringEncoding Symbol (Mac OS) X-MAC-SYMBOL
7 NSNonLossyASCIIStringEncoding Non-lossy ASCII
8 NSShiftJISStringEncoding Japanese (Windows, DOS) CP932
9 NSISOLatin2StringEncoding Central European (ISO Latin 2) ISO-8859-2
10 NSUnicodeStringEncoding Unicode (UTF-16) UTF-16
11 NSWindowsCP1251StringEncoding Cyrillic (Windows) WINDOWS-1251
12 NSWindowsCP1252StringEncoding Western (Windows Latin 1) WINDOWS-1252
13 NSWindowsCP1253StringEncoding Greek (Windows) WINDOWS-1253
14 NSWindowsCP1254StringEncoding Turkish (Windows Latin 5) WINDOWS-1254
15 NSWindowsCP1250StringEncoding Central European (Windows Latin 2) WINDOWS-1250
21 NSISO2022JPStringEncoding Japanese (ISO 2022-JP) ISO-2022-JP
30 NSMacOSRomanStringEncoding Western (Mac OS Roman) MACINTOSH
-1677721344 Unicode (UTF-32LE) UTF-32LE
-1744830208 Unicode (UTF-32BE) UTF-32BE
-1811939072 Unicode (UTF-16LE) UTF-16LE
-1879047936 Unicode (UTF-16BE) UTF-16BE
-1946156800 Unicode (UTF-32) UTF-32
-2147480574 Western (EBCDIC Latin 1) IBM037
-2147481079 Traditional Chinese (Big 5-E)
-2147481080 Ukrainian (KOI8-U) KOI8-U
-2147481082 Traditional Chinese (Big 5 HKSCS) Big5-HKSCS
-2147481083 Simplified Chinese (HZ GB 2312) HZ-GB-2312
-2147481084 Western (Mac Mail) X-MAC-ROMAN-LATIN1
-2147481085 Traditional Chinese (Big 5) BIG5
-2147481086 Cyrillic (KOI8-R) KOI8-R
-2147481087 Japanese (Shift JIS) SHIFT_JIS
-2147481280 Korean (EUC) EUC-KR
-2147481295 Traditional Chinese (EUC) EUC-TW
-2147481296 Simplified Chinese (EUC) EUC-CN
-2147481536 Korean (ISO 2022-KR) ISO-2022-KR
-2147482062 Chinese (GB 18030) GB18030
-2147482063 Chinese (GBK) GBK
-2147482072 Japanese (Shift JIS X0213) Shift_JIS
-2147482360 Vietnamese (Windows) WINDOWS-1258
-2147482361 Baltic Rim (Windows) WINDOWS-1257
-2147482362 Arabic (Windows) WINDOWS-1256
-2147482363 Hebrew (Windows) WINDOWS-1255
-2147482589 Traditional Chinese (Windows DOS), CP950
-2147482590 Korean (Windows DOS), CP949
-2147482591 Simplified Chinese (Windows DOS), CP936
-2147482595 Thai (Windows DOS), CP874
-2147482596 Greek (DOS Greek 2) IBM869
-2147482597 Cyrillic (DOS) CP866
-2147482598 Nordic (DOS)
-2147482599 Arabic (DOS) cp864
-2147482600 Canadian French (DOS)
-2147482601 Hebrew (DOS) DOS-862
-2147482602 Icelandic (DOS) CP861
-2147482603 Portuguese (DOS)
-2147482604 Turkish (DOS) CP857
-2147482605 Cyrillic (DOS)
-2147482606 Central European (DOS Latin 2) CP852
-2147482607 Greek (DOS Greek 1)
-2147482608 Western (DOS Latin 1) CP850
-2147482618 Baltic Rim (DOS) CP775
-2147482619 Greek (DOS) CP737
-2147482624 Latin-US (DOS) CP437
-2147483120 Romanian (ISO Latin 10) ISO-8859-16
-2147483121 Western (ISO Latin 9) ISO-8859-15
-2147483122 Celtic (ISO Latin 8) ISO-8859-14
-2147483123 Baltic Rim (ISO Latin 7) ISO-8859-13
-2147483125 Thai (ISO 8859-11) ISO-8859-11
-2147483126 Nordic (ISO Latin 6) ISO-8859-10
-2147483127 Turkish (ISO Latin 5) ISO-8859-9
-2147483128 Hebrew (ISO 8859-8) ISO-8859-8
-2147483129 Greek (ISO 8859-7) ISO-8859-7
-2147483130 Arabic (ISO 8859-6) ISO-8859-6
-2147483131 Cyrillic (ISO 8859-5) ISO-8859-5
-2147483132 Central European (ISO Latin 4) ISO-8859-4
-2147483133 Western (ISO Latin 3) ISO-8859-3
-2147483412 Inuit (Mac OS)
-2147483496 Cyrillic (Mac OS Ukrainian) X-MAC-UKRAINIAN
-2147483508 Farsi (Mac OS) X-MAC-FARSI
-2147483607 Keyboard Symbols (Mac OS)
-2147483608 Gaelic (Mac OS)
-2147483609 Celtic (Mac OS)
-2147483610 Romanian (Mac OS) X-MAC-ROMANIAN
-2147483611 Icelandic (Mac OS) X-MAC-ICELANDIC
-2147483612 Croatian (Mac OS) X-MAC-CROATIAN
-2147483613 Turkish (Mac OS) X-MAC-TURKISH
-2147483614 Dingbats (Mac OS) X-MAC-DINGBATS
-2147483619 Central European (Mac OS) X-MAC-CENTRALEURROMAN
-2147483622 Tibetan (Mac OS) X-MAC-TIBETAN
-2147483623 Simplified Chinese (Mac OS) X-MAC-SIMP-CHINESE
-2147483627 Thai (Mac OS) X-MAC-THAI
-2147483637 Gujarati (Mac OS) X-MAC-GUJARATI
-2147483638 Gurmukhi (Mac OS) X-MAC-GURMUKHI
-2147483639 Devanagari (Mac OS) X-MAC-DEVANAGARI
-2147483641 Cyrillic (Mac OS) X-MAC-CYRILLIC
-2147483642 Greek (Mac OS) X-MAC-GREEK
-2147483643 Hebrew (Mac OS) X-MAC-HEBREW
-2147483644 Arabic (Mac OS) X-MAC-ARABIC
-2147483645 Korean (Mac OS) X-MAC-KOREAN
-2147483646 Traditional Chinese (Mac OS) X-MAC-TRAD-CHINESE
-2147483647 Japanese (Mac OS) X-MAC-JAPANESE
                                                                                                                                                 
:
Posted by netkorea

How to Adjust “Delete” UIButton for UITableView deletion state

- (void)didTransitionToState:(UITableViewCellStateMask)state
{
    [super willTransitionToState:state];
    if (state == UITableViewCellStateShowingDeleteConfirmationMask)
    {
        for (UIView *subview in self.subviews)
        {
            if ([NSStringFromClass([subview class]) isEqualToString:@"UITableViewCellDeleteConfirmationControl"])
            {
                UIView *deleteButtonView = (UIView *)[subview.subviews objectAtIndex:0];
                CGRect frame = deleteButtonView.frame;
                frame.origin.x = {NEW X ORIGIN};
                frame.origin.y = {NEW Y ORIGIN};
                deleteButtonView.frame = frame;
            }
         }
    }
}
:
Posted by netkorea
2010. 10. 13. 01:02

NSLog 개선 관련 팁들 개발 - iPhone/개발 Tip2010. 10. 13. 01:02

The Most Useful Objective-C Code I’ve Ever Written « Vincent Gable’s Blog
http://vgable.com/blog/2010/08/19/the-most-useful-objective-c-code-ive-ever-written/

LOG_EXPR(self.window.screen);

self.window.screen = <UIScreen: 0x6d20780; bounds = {{0, 0}, {320, 480}}; mode = <UIScreenMode: 0x6d20c50; size = 320.000000 x 480.000000>>

LOG_EXPR(self.tabBarController.viewControllers);

self.tabBarController.viewControllers = (
“<UINavigationController: 0xcd02e00>”,
“<SavingsViewController: 0xcd05c40>”,
“<SettingsViewController: 0xcd05e90>”
)

:
Posted by netkorea
http://www.cocos2d-iphone.org/forum/topic/5270#post-31812

Hey guys and gals, just let y'all know ahead of time that I have an updated version of my gesture detection class that I am about to release in the next several days.

One, it fixes several bugs.

Two, it is now a singleton, which means you now just call [Gestures sharedGestures] to access the object.

Three, it now uses delegates for when a gesture is detected. To set the delegate to call you do [Gestures sharedGestures].delegate = self or any other object that implements the Gestures Delegates. I will have further instructions on how to set it up when I release it in the coming days.

Four, the delegates are all optional, meaning you do not have to implement all of them if you only want to use one of them. The class automatically checks to see if the delegate method is available before calling it.

Five, it now only stores one array of points for all classes, which means it uses less memory. Also, due to that it now will check against all different types of gestures at the same time and send a delegate response to the ones detected. However, there may be a slight concern if you implement the special circle, x, or square gestures and a sliding gesture, because both may be detected at the same time.

Six, it now how has helper functions for calculating velocity for X and Y for two specified points based on a certain travel time. I implemented this because I found I needed it when using chipmunk physics engine to move objects to certain points within a given time frame. The functions are separated into one for X Velocity and Y Velocity, so you know how much to apply for the cpVect for both x and y. Technically, this should work just fine with box2d also, because it uses the standard acceleration physics formula between two points in a given time.

Finally, here is the updated version of the gesture class:

http://www.vantagetechnic.com/programming/iphone/Gestures.zip

Here are examples on how to use the class functions and delegates:

How to setup the GestureComplete Delegate:

@mojo - Yes - and Metric was kind enough to share the following code with me:

-(void) ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event {
	CGPoint point = [touch locationInView: [touch view]];
	CGPoint converted = [[CCDirector sharedDirector] convertToGL:point];

        //Do something on moved with object

        //Add point to the Gestures point buffer
        [[Gestures sharedGestures] addPoint:converted];
}

This is a very good i just find that the gesture are firing over and over again

and the default values don't seem to work any one fancy sharing there settings for circles squares and x?

these were the only things i tweaked for circle on the iPad:

//anything longer than 2 seconds and...well that's just not fast enough
[Gestures sharedGestures].circle.maximumCircleTime = 2.0;
//being a bit more generous since i only really want circle to work
[Gestures sharedGestures].circle.circleClosureDistanceVariance = 160.0;




:
Posted by netkorea
http://www.cocos2d-iphone.org/forum/topic/4219

I decided to use a category to work-around this issue. Create a class called "CCMoveTo+RoundedUpdate" and add this code:

CCMoveTo+RoundedUpdate.h

//
//  CCMoveTo+RoundedUpdate.h
//
//	Category to rounded move any object and avoid gaps in tilemap.
//  --> Overrides "update" code from CCIntervalAction.m
//
//  Created by Markus Barta on 09.02.10.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"
@interface CCMoveTo (RoundedUpdate)
@end

CCMoveTo+RoundedUpdate.m

//
//  CCMoveTo+RoundedUpdate.m
//
//  Created by Markus Barta on 09.02.10.
//
#import "CCMoveTo+RoundedUpdate.h"

@implementation CCMoveTo (RoundedUpdate)
-(void) update: (ccTime) t
{
	//NSLog(@"Using category CCMoveTo+RoundedUpdate for movement -> rounded setPosition!");
	[target setPosition: ccp( round(startPosition.x + delta.x * t ), round(startPosition.y + delta.y * t ) )]; //Setting to a rounded pos avoids gaps in tilemap!
}
@end

Just add those two files to your project and compile. The gaps should be gone :)


:
Posted by netkorea
http://www.cocos2d-iphone.org/forum/topic/7927

That's a fun one... I had to sit down with some graph paper and math and spend a while working it out, I wanted a simple solution that would work in all cases no matter the map size. Hope this saves you some time.

I use multiple ISO map sizes and the touchToXY is in my base map class, it works no matter the map size it will always return the X,Y. Top most tile of the diamond being 0,0.

Here is my solution:

-(CGPoint)touchToXY:(CGPoint)touch map:(CCTMXTiledMap *)_map mapsize:(int)_mapsize
{
	touch = [[CCDirector sharedDirector] convertToGL:touch];
	touch = [_map convertToNodeSpace:touch];
	CGSize ts = [_map tileSize];
	int isoy = (((touch.y/ ts.height) + (touch.x - (_mapsize * ts.width/2)) / ts.width) - _mapsize) *-1;
	int isox = (((touch.y/ ts.height) - (touch.x - (_mapsize * ts.width/2)) / ts.width) -_mapsize) *-1;
	return ccp(isox,isoy);
}

To call it:

Variables you need to define are

<CCTMXTiledMap> = Your Tile Map
<MapWidthInTiles> = How big is the grid.  20 if it's 20x20, 30 if it's 30x30 etc..

Call from your touch code:

CGPoint myTouch = [touch locationInView: [touch view]];
CGPoint isoXY = [self touchToXY:myTouch map:<CCTMXTiledMap> mapsize:<MapWidthInTiles>];
Posted 2 months ago #

:
Posted by netkorea

http://www.iphonedevsdk.com/forum/iphone-sdk-development/52507-user-resize-image-screen.html
Unread 07-07-2010, 10:18 PM   #2 (permalink)
Registered Member
 
Join Date: May 2009
Posts: 22
Default

Quote:
Originally Posted by mitchsamuels View Post
Hello, I have an image on my view that is draggable. How can I make it so the user is able to resize the image on the screen by pinching.
Easiest way to do that is to use UIGestureRecognizer. That is new to iPhone OS 3.2 (or iOS4 for iPhones).

Basically, you make a UIPinchGestureRecognizer and add it to your view, and in UIGestureRecognizer you register for a callback. When that is done, when the user has started pinching, it will not only callback, but the UIPinchGestureRecognizer will give you a scale by how much, which you can immediately translate into a scale.

Relevant Text:

UIGestureRecognizer Documentation
:
Posted by netkorea
2010. 9. 9. 11:41

iPhone Keychain Access 개발 - iPhone/개발 Tip2010. 9. 9. 11:41

GenericKeychain 1.1(http://developer.apple.com/library/ios/#samplecode/GenericKeychain/Listings/Classes_AppDelegate_h.html#//apple_ref/doc/uid/DTS40007797-Classes_AppDelegate_h-DontLinkElementID_3)
을 이용해서 KeyChain에 반영했었는데, 3.1.2에서는 문제가 없었는데 iOS 4.0이상에서 제대로 실행되지 않더군요.

검색해보니 위 링크처럼 1.2가 새로 나와서 적용했는데, 1.1이랑 코드가 거의 안바뀐거 같은데도 온갖 에러가 발생하더군요.

2-3일 고생하다가 http://useyourloaf.com/blog/tag/keychain 에서 방법을 찾았네요.
짜증~ ㅠㅠ

keychain에 등록 중 발생하는 에러코드
http://developer.apple.com/library/mac/#documentation/Security/Reference/keychainservices/Reference/reference.html

Result Codes

The most common result codes returned by Keychain Services are listed in the table below. The assigned error space for Keychain Services is discontinuous: –25240 through –25279 and –25290 through –25329. Keychain Item Services may also return noErr (0) or paramErr (–50), or CSSM result codes (see Common Security: CDSA and CSSM, version 2 (with corrigenda) from The Open Group (http://www.opengroup.org/security/cdsa.htm)).
Result Code Value Description
errSecSuccess 0 No error.

:
Posted by netkorea
http://snipplr.com/view/39706/setting-cocos2d-camera-position-using-ccfollow/

  1. -(void)setPlayerPosition:(CGPoint)position {
  2. CGPoint tileCoord = [self tileCoordForPosition:position];
  3. int tileGid = [_meta tileGIDAt:tileCoord];
  4. if (tileGid) {
  5. NSDictionary *properties = [_tileMap propertiesForGID:tileGid];
  6. if (properties) {
  7. NSString *collision = [properties valueForKey:@"Collidable"];
  8. if (collision && [collision compare:@"True"] == NSOrderedSame) {
  9. return;
  10. }
  11. NSString *collectable = [properties valueForKey:@"Collectable"];
  12. if (collectable && [collectable compare:@"True"] == NSOrderedSame) {
  13. [_meta removeTileAt:tileCoord];
  14. [_foreground removeTileAt:tileCoord];
  15. self.numCollected++;
  16. [_hud numCollectedChanged:_numCollected];
  17. }
  18. }
  19. }
  20.  
  21. ccTime moveDuration = 0.3;
  22. id playerMove = [CCMoveTo actionWithDuration:moveDuration position:position];
  23. id cameraMove = [CCFollow actionWithTarget:_player worldBoundary:CGRectMake(0, 0, (_tileMap.mapSize.width * _tileMap.tileSize.width), (_tileMap.mapSize.height * _tileMap.mapSize.height))];
  24. [_player runAction:playerMove];
  25.  
  26. [self runAction:cameraMove];
  27.  
  28. }

:
Posted by netkorea
2010. 8. 6. 17:18

NSZombieEnabled 개발 - iPhone/개발 Tip2010. 8. 6. 17:18

인터넷 돌아다니다가 우연히 보게되었는데 나중에 디버깅할 때 쓸모있을지 몰라서 올려둡니다.
http://www.cocoadev.com/index.pl?NSZombieEnabled

메모리 할당과 해제는 정말 어렵죠. ^^;
아 할당과 해제가 어려운게 아니라 그걸 제대로 지켜가면서 사용하는게 어렵다고 해야할려나요.
개인적 생각으론 Java나 C#처럼 그냥 알아서 해주든지 C/C++처럼 명시적으로 해주면 좀 더 명확할건데 autorelease랑 factory개념때문에 처음 입문하거나 새로운 Class를 사용하게되는 경우 더 힘들지 않나 싶네요.. 뭐든지 다 마찬가지겠지만 익숙해지면 나아지겠죠. ^^;

아 중요한 NSZombieEnabled에 대한 설명이 없이 잡설만 늘어놨네요.
위 링크에 가시면 자세한 설명이 나와있지만, 간략히 말씀드리면 이놈은 Memory 해제시 실제 해재하지 않고 단지 해제했다는 mark만 달고 해제한 오브젝트에 메시지를 보낼 경우 로그를 남기게 됩니다. 이런게 왜 필요하냐면, 메모리 해제를 한 후 그 해제한 오브젝트를 이용해서 뭔가 할 경우 이상하게(undefined라고 하죠 ^^) 작동해서 그 원인을 찾기가 매우 어렵기 때문에, 해제한 오브젝트에대한 호출을 쉽게 찾기 위해서입니다.  예전에 C++에서도 비슷한 경우에 대한 처리방법에 대한 기사를 읽었던거 같은데 너무 오래전이라 기억이 가물가물하네요. 요즘은 C#을 알게된 뒤론 C나  C++은 소스만 봐도 이상하게 보이는 듯 하네요. ㅎㅎ
:
Posted by netkorea