小编Cha*_* SP的帖子

NSLog(@"%@",超级)崩溃

我在一个方法(任何方法)中使用了NSLog(@"%@",super ),它正在崩溃....为什么?如何打印超级内容?

更新 :

currentclassname : superClassName
{
}
Run Code Online (Sandbox Code Playgroud)

如果我使用NSLog(@"%@",[超级描述]); 它是打印"<currentclassname: 0x3db7230>"而不是superClassName ...它应该打印superClassName权限.

提前致谢,

iphone cocoa cocoa-touch objective-c

2
推荐指数
1
解决办法
650
查看次数

NSMutableArray与堆栈

我正在Objectice-C中为iphone开发2D游戏.在这个项目中我需要使用堆栈,我可以使用STL(标准模板库)堆栈或NSMutableArray来完成它,因为这个堆栈在游戏中被广泛使用,其中一个更高效在运行速度和内存使用方面?

@interface CarElement : NSObject
{
  std::stack<myElement*> *mBats;
}
Run Code Online (Sandbox Code Playgroud)

要么

@interface CarElement : NSObject
{
  NSMutableArray *mBats;
}
Run Code Online (Sandbox Code Playgroud)

谢谢,

c++ iphone performance objective-c

1
推荐指数
1
解决办法
651
查看次数

Ipad设备定位问题

我对我的UIViewController呈现使用presentModalViewController MFMailComposeViewController(mailController),在mailController(MFMailComposeViewController的子类)类我有overhide shouldAutorotateToInterfaceOrientation为

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)

但是在我的UIViewController类中,我已经过度隐藏了shouldAutorotateToInterfaceOrientation(这是我的项目需要)

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
    {
return NO;
    }
Run Code Online (Sandbox Code Playgroud)

提出我mailcontroller后,如果我旋转设备它完全如预期在iPhone(支持landscapeleft /右方向)...但相同的代码是不是在iPad上运行.我在这里做错了吗?这是苹果虫吗?

我正在使用这个api [myViewController presentModalViewController:mailController animated:YES];

我在iPhone和iPad上都收到了这个警告视图控制器 <UINavigationController: 0x7720920> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.

谢谢,

iphone cocoa-touch uiviewcontroller ipad

1
推荐指数
1
解决办法
2654
查看次数

字符串操作

如果有像"com.mycompany.purchase1"这样的NSString如何只获得purchase1.

NSString *mainString = @"com.mycompany.purchase1";

-(NSString*)getLastComponent : (NSString*) mainString
{
NSString *string;
//Implementation
return string;//It should return only "purchase1"
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用lastPathComponent,pathExtension,我也不能使用substringToIndex,因为字符串可能有不同的长度.

iphone cocoa nsstring

1
推荐指数
1
解决办法
165
查看次数

如何编码网址

NSString* urlEncode(NSString * url)
{
    string inStr = StringFromNSString(url);
    CFStringRef inStringRef = CFStringCreateWithCString( kCFAllocatorDefault, inStr.c_str(), kCFStringEncodingUTF8 );
    NSString * encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)inStringRef,NULL,(CFStringRef)@"!*’();:@&=+$,/?%#[]",kCFStringEncodingUTF8 );
    return encodedString;
}
Run Code Online (Sandbox Code Playgroud)

我使用上面的方法来编码网址...即使我的应用程序崩溃说

<body>
    <div id="content">
        <h1>An Error Was Encountered</h1>
        <p>The URI you submitted has disallowed characters.</p> </div>
</body>
</html>
terminate called after throwing an instance of 'std::invalid_argument'
  what(): 
Run Code Online (Sandbox Code Playgroud)

任何想法..我的代码有什么问题?

仅供参考:它在这个方法中崩溃JSONNode jsonObject0 = libJSON :: parse(inResponseData);

更新:我发送消息的服务器是UNIX服务器是否导致问题?

iphone url objective-c

1
推荐指数
1
解决办法
5262
查看次数

安装xCode4.3后,filemerge应用程序无法从svnX运行?

我刚刚安装了xcode 4.3,因为他们在xCode包中移动了filemerge应用程序.filemerge没有通过svnX app(我在svnX中将默认应用程序设置为filemerge)来查找差异.如何解决这个问题(Xcode4.3 + svnX + filemerge)?

iphone xcode4 xcode4.3

1
推荐指数
1
解决办法
1273
查看次数

使用coredata时,Tableview行平滑动画

当我从coredata获得回调时,我正在使用插入行到tableview

- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
{
    [self.contentTableView endUpdates];
}

    - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject
           atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type
          newIndexPath:(NSIndexPath *)newIndexPath {

    //other code
                [tableView insertRowsAtIndexPaths:@[newIndexPath] withRowAnimation:UITableViewRowAnimationFade];

    //other code
    }

- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller {

    [self.contentTableView beginUpdates];
}
Run Code Online (Sandbox Code Playgroud)

由于didchangeobject多次调用,因此tableview行插入动画不流畅(视频附加).任何想法如何使动画流畅.

animation core-data objective-c uitableview ios

0
推荐指数
1
解决办法
444
查看次数