我正在尝试根据我在TableView中选择的行将数据发送到我的DetailViewController.我的项目是用StoryBoard制作的.
我的TableViewCell与我的MainStoryBoard中的UIView链接得很好,一切都很好,我不知道如何将所选行的信息发送到我的DetailView
这是我有的:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSUInteger oldRow = [lastIndexPath row];
NSString *key = [keys objectAtIndex:section];
detailRow = [names objectForKey:key];
static NSString *SectionsTableIdentifier = @"SectionsTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SectionsTableIdentifier];
if (cell == nil)
{
CGRect cellFrame = C
GRectMake(0, 0, 300, 65);
cell = [[UITableViewCell alloc] initWithFrame:cellFrame] ;
}
CGRect nameLabelRect = CGRectMake(200, 5, 200, 15);
UILabel *nameLabel = [[UILabel alloc] initWithFrame:nameLabelRect];
nameLabel.tag = kNameValueTag; …Run Code Online (Sandbox Code Playgroud) 我想得到一个字符串的值.值在NSDictionnary中,但NSDIctionnary在NSArray中.
我怎样才能获得价值?例如,我想获得关键字"路径"的字符串
谢谢你的帮助.
<array>
<dict>
<key>path</key>
<string>2.mov</string>
<key>width</key>
<string>768</string>
<key>height</key>
<string>1024</string>
</dict>
</array>
Run Code Online (Sandbox Code Playgroud) 我想将NSArray添加到我的NSMutable(appdelegate中的init)
这是我的代码,每次按下按钮(男性,女性,情侣)时都会调用该方法,因此必须将NSArray添加到MutableArray中,但我不知道我尝试过但不起作用.:
- (void) sexChoosen:(NSString *) sexe
{
NSError *err;
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Boxes" inManagedObjectContext:context];
[request setEntity:entity];
NSArray *arrayForPredicate = [context executeFetchRequest:request error:&err];
NSPredicate *sex;
sex = [NSPredicate predicateWithFormat:@"sexe = %@", sexe];
NSArray *BoxWithSex = [arrayForPredicate filteredArrayUsingPredicate:sex];
//NSMutableArray* tmp = [self createMutableArray:BoxWithSex];
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"FIRST %@", appDelegate.myArray);
// HERE IS THE CODE TO ADD THE ARRAY TO MY NSMUTABLE ARRAY = AppDelegate *appDelegate
NSLog(@"SECOND %@", appDelegate.myArray);
}
Run Code Online (Sandbox Code Playgroud)