我正在尝试在我的CoreData实体食谱中准备多个搜索.有一些参数,我想准备提取.
食谱属性:
@property (nonatomic, retain) NSNumber * difficulty;
@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSNumber * code; //like identifier
@property (nonatomic, retain) NSNumber * prepTime;
Run Code Online (Sandbox Code Playgroud)
成分是一个单独的实体与成分列表.
Join实体包含ingredientCode,recipeCode,count.
getArrayOfJoinDataWithIngredients获取连接实体并返回包含一些输入成分的配方代码的NSArray .
这是我的代码:
- (IBAction)callRecipeFetch:(id)sender
{
NSString *predicateString = @"";
NSArray *codes = [[NSArray alloc] init]; codes = nil;
if ([paramController.ingredientsForSearchArray count] > 0) {
NSMutableArray *ingredientsArray = [[NSMutableArray alloc] init];
for (Ingredients *ingredient …Run Code Online (Sandbox Code Playgroud) 我有XIB文件TimerCell.xib用UITableViewCell.在cellForRowAtIndexPath的其他类中,我初始化为UITableViewCell:
static NSString *CellIdentifier = @"cellTimer";
TimerCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
//cell = [[TimerCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TimerCell"owner:self options:nil];
cell = [nib objectAtIndex:0];
Run Code Online (Sandbox Code Playgroud)
在我的TimerCell中,我有两个UILabel和一个UIButton.对于这个按钮,我想设置一些方法的动作.
我怎样才能做到这一点?以及如何UILabel实时显示来自我的背景倒数计时器的数据?
这是关于push-segue的问题,请转到iOS应用中的"主页".
一切正常,但push-segue只有一个"从右到左"的动画类型.在iPad应用程序中它并不美观.那么,我怎么能改变动画类型,例如,"淡化"?
或者可能有其他方式来准备我想要的东西.
我正在尝试UICollectionReusableView在UICollectionView标题中使用自定义(具有自己的类和XIB).但是在获取标题后的数据后,我什么都没有.
我的步骤:
在viewDidLoad中注册类:
[self.collectionView registerClass:[CollectionViewHeader class]
forSupplementaryViewOfKind: UICollectionElementKindSectionHeader
withReuseIdentifier:@"HeaderView"];
Run Code Online (Sandbox Code Playgroud)试图显示:
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
{
UICollectionReusableView *reusableView = nil;
if (kind == UICollectionElementKindSectionHeader) {
CollectionViewHeader *collectionHeader = [self.collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
NSInteger section = [indexPath section];
id <NSFetchedResultsSectionInfo> sectionInfo = [fetchRecipes sections][section];
collectionHeader.headerLabel.text = @"bla-bla-bla";
reusableView = collectionHeader;
}
return reusableView;
}
Run Code Online (Sandbox Code Playgroud)谁能告诉我什么是错的?)感谢您的任何建议
我正在使用Delphi 2010和superobject库.
我已经了解如何解析json文件,但我不知道如何创建json?
算法是:
需要一些例子.
谢谢.
我有UIView很多子视图(UILabel,UITextView等).
如果设置alpha 0.6到主视图所有子视图都采用此alpha.
如何分别设置主视图的alpha?
有两个实体(Department < - >> Employee).
该部门有4名员工.当我获取此部门中的所有员工时,我的日志窗口显示:
CoreData:注释:总获取执行时间:4行0.0017秒.
一切安好.
但UICollectionView只显示第一名员工4次.例如:
Employee1,Employee1,Employee1,Employee1
代替
Employee1,Employee2,Employee3,Employee4
我在cellForItemAtIndexPath中有一些错误:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"cellRecipe";
collectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
Employee *emp = [array_ objectAtIndex:indexPath.item];
cell.name.text = emp.name;
cell.image.image = emp.thumbImg;
return cell;
}
Run Code Online (Sandbox Code Playgroud)
array_是fetch之后的NSMutableArray
如何在CoreData中使用多对多关系进行操作?例如:
我有2个实体 - 食谱和配料
CoreData将它们像Recipes << - >> Ingredients链接起来.现在我需要为食谱中的每种成分添加属性"Count".我该怎么做?
谢谢
使用Ray的好教程 ......
为什么我无法从设备加载InApp-Purchases(didFailWithError: calls)列表,但在模拟器中我可以?
EDITED
如果我在设备didFailWithError:方法调用上运行app :
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
NSLog(@"Cannot load the list of products...");
NSLog(@"Error - %@", error.description);
_productsRequest = nil;
_completionHandler(NO, nil);
_completionHandler = nil;
}
Run Code Online (Sandbox Code Playgroud)
这是错误描述:
Error - Error Domain=NSURLErrorDomain Code=-1004 "Cannot connect to iTunes Store" UserInfo=0x1cdb19c0 {NSLocalizedDescription=Cannot connect to iTunes Store}
Run Code Online (Sandbox Code Playgroud)
解决了
我很抱歉,但问题在于代理.一些网站(包括Apple的网站)已经关闭.
现在它有效!谢谢!
总体而言,我从JSON对中获取了一个包含“ \ n”符号的字符串。例如,
“我可以看到地球如何养育其草皮,\\\ n \ n \ n \ n \ n \ n \ n \ s \ n \ n \ s \ n \ n \ s \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ n \ …
有UITableViewCell哪些包含UIButton.
在我的cellForRowAtIndexPath中:
cell.toCartBtn.tag = indexPath.row;
[cell.toCartBtn addTarget:self
action:@selector(toCart:) forControlEvents:UIControlEventTouchDown];
Run Code Online (Sandbox Code Playgroud)
在toCart方法中,我需要通过tapped按钮标记获取行和节.我该怎么做?
有UIViewController哪些包含UICollectionView.还有UICollectionViewCell自己的类和XIB(CurrentCell.h,CurrentCell.m,CurrentCell.xib).
在我的UIViewController.h:
@property (strong, nonatomic) IBOutlet UICollectionView *collection;
Run Code Online (Sandbox Code Playgroud)
在我的UIViewController.m:
@synthesize collection;
Run Code Online (Sandbox Code Playgroud)
在viewDidLoad中:
[self.collection registerClass:[CurrentCell class] forCellWithReuseIdentifier:@"cellCurRecipe"];
UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
[flowLayout setItemSize:CGSizeMake(120, 90)];
[flowLayout setSectionInset:UIEdgeInsetsMake(5, 10, 5, 10)];
[flowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
[self.collection setCollectionViewLayout:flowLayout];
Run Code Online (Sandbox Code Playgroud)
在cellForItemAtIndexPath中:
static NSString *CellIdentifier = @"cellCurRecipe";
CurrentCell *cell = (CurrentCell *)[self.collection dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath];
Recipes *recipe = [currRecipesArray objectAtIndex:indexPath.item];
[cell.image setImage: recipe.image];
return cell;
Run Code Online (Sandbox Code Playgroud)
但是:如果我直观地点击了单元格didSelectItemAtIndexPath方法调用.
EDITED
现在一切正常!
我忘了在CurrentCell.m中初始化单元格:
- (id)initWithFrame:(CGRect)frame …Run Code Online (Sandbox Code Playgroud) ios ×9
core-data ×2
uitableview ×2
alpha ×1
animation ×1
coronasdk ×1
delphi ×1
json ×1
lua ×1
many-to-many ×1
nspredicate ×1
segue ×1
string ×1
superobject ×1
uiview ×1
xib ×1