我有一张金属表
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)
看起来我完全错了.请帮忙.
我尝试在xCode4中打开Apple网站上的"Reachability"示例.我点击Reachability.xcodeproj并仅获得警告'No Editor'.它意味着什么以及如何解决它.提前致谢.
安装了Mountain Lion和Xcode5.试图打开最近为iOS6开发的项目.现在xcode非常慢.他现在有什么想法吗?
编辑

它可以快速完成我创建的新项目.它只在我打开旧项目时才会变慢.
在我的数据库中,我有一排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)
谢谢你的回复
首先,当滚动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行为的真正原因以及如何解决它?
我有.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) 使用:
每个单元格上都有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)
邪恶在哪里?先感谢您.
我有一个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)
通常,导航工作.当然,问题是导航不能在首先选择的单元格上工作.任何帮助深表感谢.
我想输出几个问题,但是以随机顺序排列.如何在不重复的情况下随机提出所有问题?
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) ios ×4
objective-c ×4
cocoa-touch ×2
sqlite ×2
storyboard ×2
uitableview ×2
asp.net ×1
c#-4.0 ×1
inner-join ×1
iphone ×1
join ×1
segue ×1
sql ×1
sql-server ×1
xcode ×1
xcode4 ×1