我有excel文件,转换成文本文件(文件 - >另存为),现在我想将这个文件导入MySQL,我听说LOAD DATA INFILE可以很快地做到这一点,但我不知道如何使用它,我应该写一个PHP脚本,我把它的LOAD DATA INFILE语法?
当我建立我有错误:
JSON.h : File not found
Run Code Online (Sandbox Code Playgroud)
明显的假设使我认为JSON.h文件不在导入到我的项目的框架文件夹中,是的,它与该名词不存在但是有一个名为的文件SBJson.h.我已经按照这个一步一步的教程.
我有两个UIImageView填充视图控制器,第一个填充上半部分,第二个填充下半部分.我直接在storyboard文件中设置它们.
在该viewDidLoad方法中,我设置代码以便为两者执行动画UIImageView,因此它看起来像一个被打开的篮子(第一个UIImageView移动到顶部直到它离开视图,第二个UIImageView移动到底部直到它离开视图的视图).
到目前为止这是我的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
CGRect basketTopFrame = self.basketTop.frame;
basketTopFrame.origin.y = -basketTopFrame.size.height;
CGRect basketBottomFrame = self.basketBottom.frame;
basketBottomFrame.origin.y = self.view.bounds.size.height;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelay:1.0];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
self.basketTop.frame = basketTopFrame;
self.basketBottom.frame = basketBottomFrame;
[UIView commitAnimations];
}
Run Code Online (Sandbox Code Playgroud)
但是行为与我期望的不同,顶部框架没有移动,底部框架从左上到下动画(原点位置,而不是移出视图).
这是UIImageViews我在故事板中设置的位置:

这是UIImageViews我启动应用程序的时候:

这是UIImageViews应用程序完成动画(viewDidLoad)的时候:

请注意,此代码适用于Xcode 4.2,但自从升级到Xcode 4.5并使用Storyboard后,我开始遇到此问题.Thanx提前.
我想改变图片中显示的信息Dark按钮的颜色(右上角)是可见的.

我正在研究应该将两个数组返回到我的iOS应用程序的Web服务,这是否可以在Web服务开发中使用一个PHP类?
当我尝试读取txt文件的内容时,我不断收到此错误:
index.php文件:
<?php
$handle = fopen ("php://stdin","r");
$line = fgets($handle);
fwrite(STDOUT, "Welcome $handle");
?>
Run Code Online (Sandbox Code Playgroud)
在命令行中我做: cat texte.txt | php index.php
其中texte.txt包含一个名称.两个文件txt和php在同一个文件夹中.我曾经工作得很好,我不知道为什么这个错误出现在我的情况下.
这是我的代码,用于获取代表用户Graph的整个字典:
if (FBSession.activeSession.isOpen) {
[[FBRequest requestForMe] startWithCompletionHandler:
^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *user,
NSError *error) {
if (!error) {
NSLog(@"%@",user);//Displayed with the gender
NSLog(@"%@",user.name);//Name only displayed
NSLog(@"%@",user.gender);//Build error
}
}];
}
Run Code Online (Sandbox Code Playgroud)
我想知道性别数据有什么问题,为什么它没有在字典中找到,实际上,我得到了一个构建错误:
property 'gender' not found on object of type 'NSDictionary<FBGraphUser> *'
Run Code Online (Sandbox Code Playgroud) 我没有从远程服务器找到图像时加载默认图像:
detailImageView.image = [UIImage imageNamed:@"noimageavailable.jpg"];
Run Code Online (Sandbox Code Playgroud)
第二种选择:
detailImageView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"noimageavailable" ofType:@"jpg"]];
Run Code Online (Sandbox Code Playgroud)
我注意到在加载了另一个可从服务器获得的图像后,noimageavailable.jpg仍然出现在新图像后面,这意味着noimageavailable.jpg以某种方式缓存.我用两个选项imageNamed:和imageWithContentsOfFileAPI 得到了相同的结果.
这是我完成的代码:
if (detailImageURL.length == 0) {
detailImageView.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"noimageavailable" ofType:@"jpg"]];
//Once displayed, it's cached for all lifecycle
}else{
dispatch_async(DownloadQueue, ^{
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:detailImageURL]];
dispatch_async(dispatch_get_main_queue(), ^{
detailImageView.image = nil;
UIImage *image = [UIImage imageWithData:imageData];
detailImageView.image = image;
});
});
}
Run Code Online (Sandbox Code Playgroud)
有什么方法可以清除缓存?
在NSMutableArray我要排序是这样的:
(
{
"title" = "Bags";
"price" = "$200";
},
{
"title" = "Watches";
"price" = "$40";
},
{
"title" = "Earrings";
"price" = "$1000";
}
)
Run Code Online (Sandbox Code Playgroud)
它是一个NSMutableArray包含NSMutableArrays 的集合.我想price首先按它排序title.
NSSortDescriptor *sortByPrices = [[NSSortDescriptor alloc] initWithKey:@"price" ascending:YES];
NSSortDescriptor *sortByTitle = [[NSSortDescriptor alloc] initWithKey:@"title" ascending:YES];
[arrayProduct sortedArrayUsingDescriptors:[NSArray arrayWithObjects:sortByPrices,sortByTitle,nil]];
Run Code Online (Sandbox Code Playgroud)
但是,这似乎没有用,如何对嵌套进行排序NSMutableArray?
这用于我的预ARC代码工作正常,但由于重构所有项目是ARC兼容,我开始得到这个崩溃:
[CustomViewController respondsToSelector:]: message sent to deallocated instance
Run Code Online (Sandbox Code Playgroud)
我的项目是一个具有拆分视图的iPad应用程序,但与苹果文档相反,之前的开发人员已经在拆分视图之前在应用程序启动时显示另一个视图控制器.所以我知道这不是正确的方法,但正如我所说它在ARC集成之前曾经工作过,所以我需要解决这个问题.
根视图控制器包含项目菜单,每个项目显示要填充的详细信息表单,然后单击下一个按钮移动到下一个详细信息屏幕,等等.
当我点击根视图上的主页按钮返回主视图时,问题就开始了,这是将用户移动到主屏幕的相关代码:
//this method is in the appdelegate, and it gets called when clikc on home button located on the root view
- (void) showHome
{
homeController.delegate = self;
self.window.rootViewController = homeController;
[self.window makeKeyAndVisible];
}
Run Code Online (Sandbox Code Playgroud)
然后,当我单击按钮返回拆分视图(根/详细信息视图的位置)时,应用程序将崩溃并显示上述说明.我用应用程序分析了应用程序,并且负责的代码行位于RootViewController该didSelectRowAtIndexPath方法中,这里是相关的代码:
if(indexPath.row == MenuCustomViewController){
self.customVC=[[CustomViewController alloc] initWithNibName:@"CustomVC"
bundle:nil];
[viewControllerArray addObject:self.customVC];
self.appDelegate.splitViewController.delegate = self.customVC;
}
Run Code Online (Sandbox Code Playgroud)
customVC是一个强大的属性,我试图直接分配并分配给实例变量,但这没有帮助修复崩溃.有什么想法吗 ?
编辑: 这是由仪器给出的堆栈跟踪:
[self.appDelegate.splitViewController setViewControllers:viewControllerArray];//this line caused the crash
[viewControllerArray addObject:self.appDescVC];//this statement is called before the …Run Code Online (Sandbox Code Playgroud) memory-management uisplitviewcontroller ios automatic-ref-counting
ios ×6
php ×3
cocoa-touch ×1
command-line ×1
fb-graph ×1
ios5 ×1
ios6 ×1
iphone ×1
json ×1
mysql ×1
objective-c ×1
uiimage ×1
uiimageview ×1
uikit ×1
web-services ×1
xcode4.2 ×1