标签: xcode5

使用滑动手势删除tableview上的行

我试图通过设置滑动手势,然后使用IBAction调用删除执行滑动的行来绕过红色按钮删除(editingstyledelete).应用程序崩溃,我得到一个错误: NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

- (IBAction)deleteSwipe:(id)sender{
    [self deleteRow:self.tableView forCell:sender];
}

-(void) deleteRow:(UITableView *)tableView forCell:(UITableViewCell *)bCell{
    NSIndexPath *indexPath = [tableView indexPathForCell:bCell];
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    [self.queue removeObjectAtIndex:indexPath.row];
    [tableView reloadData];
}
Run Code Online (Sandbox Code Playgroud)

我设置了断点异常并指向:[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];在报告日志中它表示索引路径值为nil.我之前使用过'deleteRowsAtIndexPaths'方法,但没有发现这个问题.

编辑:更新的代码:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        [self.queue removeObjectAtIndex:indexPath.row];
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationLeft];
        [self.tableView reloadData];
        }
}

-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
    return UITableViewCellEditingStyleNone;


}


-(BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath{
    return …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview nsindexpath xcode5

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

如何解决ImageAssest Complile时间?

描述图像集"BG_Email_Textfield.imageset"的Contents.json必须以顶级字典开头.

我们怎么解决这个问题?

xcode5 xcode5.0.1

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

如何在ios 7和ios6中显示启动图像

我正在使用ios 7和ios 6 3.5英寸和4英寸屏幕用于ios.我正在为这两个版本的闪屏工作.在ios 7 4英寸屏幕上,它显示正确的方式.在具有4英寸屏幕的iOS 6中,它无法正常显示.我有对齐问题.带有3.5英寸的iOS 7也出现了一些对齐问题.但显示3.5英寸的iOS 6.我不知道如何解决对齐问题.这是我的示例代码:

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
    splashView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 20, 320, 548)];
    splashView.image=[UIImage imageNamed:@"screens copy.png"];
    [self.view addSubview:splashView];
    splashView.autoresizingMask =  UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |UIViewAutoresizingFlexibleBottomMargin  | UIViewAutoresizingFlexibleTopMargin;
}
else
{
    splashView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
    splashView.image=[UIImage imageNamed:@"small-screen1.PNG"];
    [self.view addSubview:splashView];
    splashView.autoresizingMask =  UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin |UIViewAutoresizingFlexibleBottomMargin  | UIViewAutoresizingFlexibleTopMargin;
}
Run Code Online (Sandbox Code Playgroud)

iphone splash-screen objective-c ios xcode5

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

如何在Cocos2d v3中设置CCTextField

这是我到目前为止所得到的:

enterName = [CCTextField textFieldWithSpriteFrame:[CCSpriteFrame frameWithImageNamed:@"Tile.png"]];
enterName.fontSize = 16.0f;
enterName.positionType = CCPositionTypeNormalized;
enterName.position = ccp(0.5f, 0.5f);
enterName.scale = 0.70f;
[self addChild:enterName z:5];
Run Code Online (Sandbox Code Playgroud)

基本上,它创建了一个几乎无法点击的微观文本字段.弹出CCTextField的唯一方法是"textFieldWithSpriteImage".

额外帮助:如何存储输入后输入的字符串.干杯.

objective-c cocos2d-iphone xcode5

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

归档我的项目时Apple Mach-O链接器错误

我正在尝试存档我的第一个iOS项目,我收到以下错误.似乎我用于身份验证的Facebook SDK和Google Plus SDK存在一些问题.我在stackoverflow上遇到过类似的问题,但没有一个解决方案对我有帮助.任何帮助,将不胜感激.提前致谢.

<pre>
Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FBRequest", referenced from:
      objc-class-ref in LoginViewController.o
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in LoginViewController.o
  "_OBJC_CLASS_$_GTLQueryPlus", referenced from:
      objc-class-ref in LoginViewController.o
  "_kGTLAuthScopePlusLogin", referenced from:
      -[LoginViewController getInfoForGoogle] in LoginViewController.o
  "_OBJC_CLASS_$_GTLServicePlus", referenced from:
      objc-class-ref in LoginViewController.o
  "_OBJC_CLASS_$_GPPURLHandler", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_GPPSignIn", referenced from:
      objc-class-ref in LoginViewController.o
  "_OBJC_CLASS_$_FBSession", referenced from:
      objc-class-ref in AppDelegate.o
      objc-class-ref in LoginViewController.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v …
Run Code Online (Sandbox Code Playgroud)

facebook ios google-plus facebook-ios-sdk xcode5

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

错误Apple Mach-O链接器在Xcode 5.1上发出警告

我最近在转移到IOS 7之后更新了我的应用程序,但是现在当我运行应用程序时,它无法构建时出现以下错误:

ld:警告:找不到选项'-F/Users/ovalerio/Desktop/GasIt2 /../../../../../../ Documents/FacebookSDK'ld的目录:警告:找不到目录选项'-F/Users/ovalerio/Desktop/GasIt2 /../../../../../../ Desktop'ld:警告:忽略文件/ Users/ovalerio/Desktop/GasIt2/GasIt /Facebook/FacebookSDK.framework/FacebookSDK,缺少文件中所需的架构arm64 /Users/ovalerio/Desktop/GasIt2/GasIt/Facebook/FacebookSDK.framework/FacebookSDK(3个片)架构arm64的未定义符号:"_ OBJC_CLASS _ $ _ FBRequestConnection",引用from:objc-class-ref in main.o"_ OBJC_CLASS _ $ _ FBSession",引自:main.o中的objc-class-ref"_OBJC_CLASS _ $ _ FBDialogs",引自:main.o中的objc-class-ref"_OBJC_CLASS_ $ _FBLoginView",引自:main.o中的objc-class-ref ld:未找到架构arm64 clang的符号:错误:链接器命令失败,退出代码为1(使用-v查看调用)

我已经仔细检查了设置,包括框架和资源,它们似乎都正确设置,任何人都知道问题是什么?任何帮助将真正受到赞赏.

ios ios7 xcode5

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

突出显示SWRevealViewController中的活动链接

我在我的项目中使用SWRevealViewController为我的应用程序创建一个滑出菜单.

是否可以突出显示滑出的菜单中当前活动的链接?

我已经尝试向sidebarviewcontroller发送页面引用标识符,但似乎这没有任何效果,因为视图仅在应用程序启动时加载一次,然后只是显示和隐藏.

任何帮助将非常感激.

干杯

xcode objective-c ios xcode5 swrevealviewcontroller

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

如何摆脱Apple Mach-O链接器错误?

首先,我有一个 Could not build module Foundation

试图通过设置Enable Modules (C and Objective-C)来解决这个问题NO

在另一个构建后,我得到了这些奇怪的错

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_EAGLContext", referenced from:
      objc-class-ref in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_GLKBaseEffect", referenced from:
      objc-class-ref in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_GLKViewController", referenced from:
      _OBJC_CLASS_$_EZAudioPlotGLKViewController in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_NSEntityDescription", referenced from:
      objc-class-ref in JSONModel+CoreData.o
  "_OBJC_CLASS_$_NSManagedObject", referenced from:
      l_OBJC_$_CATEGORY_NSManagedObject_$_JSONModel in JSONModel+CoreData.o
      objc-class-ref in JSONModel+CoreData.o
  "_OBJC_METACLASS_$_GLKViewController", referenced from:
      _OBJC_METACLASS_$_EZAudioPlotGLKViewController in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_SSLClose", referenced from:
      -[GCDAsyncSocket closeWithError:] in GCDAsyncSocket.o
  "_SSLCopyPeerTrust", referenced from:
      -[GCDAsyncSocket ssl_continueSSLHandshake] in GCDAsyncSocket.o
  "_SSLCreateContext", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c ios xcode5

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

xcode - 如何将xcode 6 storyboard文件降级为xcode 5?

如何将在xcode 6中创建的故事板中的一个降级为xcode 5?请注意,我使用的是xcode 5.

xcode ios xcode5 xcode6

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

如何从AppDelegate.m访问tabBarController?

这是我的故事板: 故事板

我试图从AppDelegate.m内的方法访问tabBarController

这是AppDelegate.h:

#import <UIKit/UIKit.h>
#import <FacebookSDK/FacebookSDK.h>
#import "STAlertView.h"


@interface demo_AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, strong) STAlertView *av;

@end
Run Code Online (Sandbox Code Playgroud)

这是AppDelegate.m:

#import "demo_AppDelegate.h"
#import "demo_Friends_ViewController.h"


@implementation demo_AppDelegate
-(void)showFriendReqAlert:(NSNotification *)pNotification{
    NSLog(@"Hello from showFriendReqAlert:");
    NSLog(@"Root: %@", [self.window.rootViewController.navigationController.tabBarController viewControllers]);

}
....
....
....
....
@end
Run Code Online (Sandbox Code Playgroud)

我的主要动机是当showFriendReqAlert:调用此方法时,会向第三个标签栏项目显示红色徽章Friends.但每当我尝试选择tabBarItem时,它在NSLog中都显示为null.

我还尝试了以下内容:self.window.rootViewController.navigationController.tabBarController self.window.rootViewController.tabBarController

但没有任何作用.有帮助吗?

谢谢!

iphone objective-c ios xcode5

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