小编NCF*_*USN的帖子

目标c功能和方法之间的区别

Objective -C中的函数和方法之间是否存在显着差异?

objective-c

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

视觉工作室2010中丢失的窗口

我是新的和愚蠢的.我关闭了这个窗口:

在此输入图像描述

如何调用此窗口以及如何激活它.让它弹出.

visual-studio-2010

19
推荐指数
2
解决办法
2万
查看次数

来自同一个表的多个INNER JOIN

我有一张金属表

MetalID    integer
MetalName  text
MetalCode  text
Run Code Online (Sandbox Code Playgroud)

物品表

ItemID     integer
ItemName   text
...
Metal1     int Ref.-> metals.metalID
Metal2     int Ref.-> metals.metalID
Metal3     int Ref.-> metals.metalID
Run Code Online (Sandbox Code Playgroud)

我正在尝试选择三个MetalCodes

SELECT m.MetalCode as 'Metal1', m.MetalCode as 'Metal2',m.MetalCode as 'Metal3'
FROM Item as k
INNER JOIN Metals AS m ON m.metalID=k.metal1 
INNER JOIN Metals AS m ON m.metalID=k.metal2
INNER JOIN Metals AS m ON m.metalID=k.metal3
WHERE k.ItemID=?
Run Code Online (Sandbox Code Playgroud)

看起来我完全错了.请帮忙.

sql sqlite join inner-join

19
推荐指数
2
解决办法
4万
查看次数

试图在xCode 4中打开项目

我尝试在xCode4中打开Apple网站上的"Reachability"示例.我点击Reachability.xcodeproj并仅获得警告'No Editor'.它意味着什么以及如何解决它.提前致谢.

xcode4

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

xcode 5,Mountain Lion:性能非常慢

安装了Mountain Lion和Xcode5.试图打开最近为iOS6开发的项目.现在xcode非常慢.他现在有什么想法吗?

编辑

在此输入图像描述

它可以快速完成我创建的新项目.它只在我打开旧项目时才会变慢.

xcode

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

SQL Server 2008中的Bool类型

在我的数据库中,我有一排UserActive.它应该是bool.SQL Server不支持bool数据类型.相似或接近它是bit0/1.好的,如果我将这个列打字,那么我如何在我的C#代码中处理它?我应该在我的代码中使用bool类型吗?

if (ud.UserActive != true)
{
   lblUserActive.Text = "Disactivated";
}
else
{
   lblUserActive.Text = "Activated";
}
Run Code Online (Sandbox Code Playgroud)

要么

if (ud.UserActive == 1)
{
   lblUserActive.Text = "Activated";
}
else
{
   lblUserActive.Text = "Disactivated";
}
Run Code Online (Sandbox Code Playgroud)

谢谢你的回复

sql-server asp.net c#-4.0

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

iOS5:UITableView滚动性能不佳

首先,当滚动tableview超出范围时,我得到内存泄漏.与此处相同的问题.

此外,我的滚动速度足够快,但在我滚动时它有点颤抖.细胞是可重复使用的.

码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    Country *country=[[self.items objectAtIndex:[indexPath section]] objectAtIndex:[indexPath row]];
    CountryCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.imageView.image=[UIImage imageNamed:country.countryFlag];
    cell.countryName.text=country.countryName;
    cell.currencyCode.text=country.code;
    cell.currencyOriginalName.text=country.originalUnitName;

    return cell;
}
Run Code Online (Sandbox Code Playgroud)

应用程序:iOS 5,ARC,Storyboard.

什么可能是这个tableView行为的真正原因以及如何解决它?

objective-c storyboard uitableview ios

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

将sqlite文件复制到Documents文件夹后,文件变空

我有.db文件的问题,复制到Documents目录后获得0 KB的大小,而原始文件是137KB.我试图在SQLite Manager中打开我复制的文件.它打开,不抱怨文件损坏......它只是不包含单个表.

我复制文件的代码:

- (void) createEditableDatabase
{
    BOOL success; 
    NSFileManager *fileManager = [NSFileManager defaultManager]; 
    NSError *error;
    NSString *writableDB = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:@"yc_ch.db"];
    success = [fileManager fileExistsAtPath:writableDB];
    if (success)
    {
        return;
    }
    NSString *defaultPath = [[NSBundle mainBundle] pathForResource:@"yc_ch" ofType:@"db"];
    error = nil;
    success = [fileManager copyItemAtPath:defaultPath toPath:writableDB error:&error];
    if (!success) 
    {
        NSAssert1(0, @"Failed to create writable database file:%@", [error localizedDescription]);
    }
}
Run Code Online (Sandbox Code Playgroud)

检查文件是否存在,如果不是副本.检查发生在RootViewController中

- (void)viewDidLoad
{
    self.subCountriesArr=[[NSMutableArray alloc]initWithCapacity:1];
    NSMutableArray *subCountriesTemp=[[[NSMutableArray alloc]init]autorelease];

    DBAccess *dbAccess=[[DBAccess alloc]init];
    [dbAccess createEditableDatabase]; //method to copy file …
Run Code Online (Sandbox Code Playgroud)

sqlite cocoa-touch ios

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

iOS 5:UITableView单元格不能平滑滚动

使用:

  • iOS 5,ARC,StoryBoards.

每个单元格上都有1个图像和文本.滚动时图像不会调整大小.有两个版本的images image.png和image@2x.png.

通过在故事板中使用UIImageView和UILabel来管理自定义单元格.

码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
Continent *continent=[self.items objectAtIndex:[indexPath row]];
ContinentCell *cell = (ContinentCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    cell.continentName.text=continent.continentName;
    cell.textView.text=continent.countriesHash;
    cell.imageView.image=[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:continent.continentImage ofType:@"png"]];
 return cell;
}
Run Code Online (Sandbox Code Playgroud)

邪恶在哪里?先感谢您.

iphone uitableview ios

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

iOS 6,Segue:第一次点击UITableViewCell时,不会调用prepareForSegue

我有一个segues的问题.我的UITableViewController有两个与其他UITableViewControllers的segue.segue从控制器链接到控制器,而不是从单元到控制器.

码:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];

if([segue.identifier isEqualToString:@"segueOne"])
{
    //implementation omitted
}
if([segue.identifier isEqualToString:@"segueTwo"])
{
   //implementation omitted
}
}
Run Code Online (Sandbox Code Playgroud)

邪恶的地方:

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(self.navigationKey==1)
{
    [self performSegueWithIdentifier:@"segueOne" sender:self];

}
if(self.navigationKey==2 || self.navigationKey==3)
{
    [self performSegueWithIdentifier:@"segueTwo" sender:self];
}
}
Run Code Online (Sandbox Code Playgroud)

通常,导航工作.当然,问题是导航不能在首先选择的单元格上工作.任何帮助深表感谢.

cocoa-touch objective-c storyboard ios segue

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

如何在switch语句中选择随机大小写

我想输出几个问题,但是以随机顺序排列.如何在不重复的情况下随机提出所有问题?

for(int i=0; i<4; i++)
{
    int question=rand()%4;
    switch(question)
    {
        case 0:
            NSLog(@"What is your name");
            break;
        case 1:
            NSLog(@"Who are you");
            break;
        case 2:
            NSLog(@"What is your name");
            break;
        case 3:
            NSLog(@"How do you do");
            break;
        case 4:
            NSLog(@"Are you?");
            break;
    }
}
Run Code Online (Sandbox Code Playgroud)

objective-c

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