小编iOS*_*per的帖子

在ios中扩展和折叠表格视图单元格

我有一个自定义单元格的表格视图和每个单元格中的一些按钮.单击单元格内的任何按钮将显示该单元格下方的另一个自定义视图.下一步单击同一按钮将折叠视图,并且所有单元格都需要相同我尝试使用insertrow方法单击按钮但是徒劳无功.如何仅使用表视图委托来完成此操作.

这是我试过的:

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

    CustomCellFor_Dashboard  *customCell = (CustomCellFor_Dashboard *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
    if (customCell == nil)
    {
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCellFor_Dashboard" owner:self options:nil];
        customCell = [nib objectAtIndex:0];
    }
    [customCell.howyoulfeelBtn  addTarget:self action:@selector(buttonclicked:) forControlEvents:UIControlEventTouchUpInside];
      customCell.nameLabel.text = @"test";
    customCell.imgView.image = [UIImage imageNamed:@"Default.png"];
   // customCell.prepTimeLabel.text = [prepTime objectAtIndex:indexPath.row];
    return customCell;
}

-(void)buttonclicked:(id)sender{
    NSIndexPath *indexPath = [myTable indexPathForCell:sender];


    [myTable beginUpdates];

     NSIndexPath *insertPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
   [myTable insertRowsAtIndexPaths:[NSArray arrayWithObject:insertPath] withRowAnimation:UITableViewRowAnimationTop];
  } 
Run Code Online (Sandbox Code Playgroud)

谁能帮我?

customization objective-c uitableview ios

20
推荐指数
3
解决办法
5万
查看次数

在iOS中将字典的NSArray转换为JSON数组

我需要以数组格式发送NSArray到服务器JSON.我怎样才能将其转换为JSON.这是NSArray我必须通过的一个样本.

array([0] => array('latitude'=>'10.010490', 
                  'longitude'=>'76.360779', 
                   'altitude'=>'30.833334', 
                  'timestamp'=>'11:17:23', 
                      'speed'=>'0.00', 
                   'distance'=>'0.00');

[1] => array('latitude'=>'10.010688', 
            'longitude'=>'76.361378', 
             'altitude'=>'28.546305', 
            'timestamp'=>'11:19:26', 
                'speed'=>'1.614', 
             'distance'=>'198.525711')
 )`
Run Code Online (Sandbox Code Playgroud)

并且所需的格式是这样的

[
  { "latitude":"10.010490",
   "longitude":"76.360779",
    "altitude":"30.833334",
   "timestamp":"11:17:23", 
       "speed":"0.00",
    "distance":"0.00"
  },    
  {
   "latitude":"10.010688",
  "longitude":"76.361378",
   "altitude":"28.546305",
  "timestamp":"11:19:26",
      "speed":"1.614",
   "distance":"198.525711" 
  }
]
Run Code Online (Sandbox Code Playgroud)

有人有解决方案吗?提前致谢.

iphone cocoa cocoa-touch json nsarray

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

在目标c中以编程方式检测YouTube视频链接

我需要从youtube等视频网站下载并保存视频.我想将它们保存到iPhone的视频库中.如何检测视频并将其保存到库中?我已经查看了一些可用的源代码.这是我在下载操作中所做的,但是无法正常工作.

- (IBAction)download {
    [downloadButton setEnabled:NO];

    [webView setUserInteractionEnabled:NO];

    UIUserInterfaceIdiom userInterfaceIdiom = [UIDevice currentDevice].userInterfaceIdiom;

    NSString *getURL = @"";

    if (userInterfaceIdiom == UIUserInterfaceIdiomPhone) {
        getURL = [webView stringByEvaluatingJavaScriptFromString:@"function getURL() {var player = document.getElementById('player'); var video = player.getElementsByTagName('video')[0]; return video.getAttribute('src');} getURL();"];
    } else {
        getURL = [webView stringByEvaluatingJavaScriptFromString:@"function getURL() {var bh = document.getElementsByClassName('bh'); if (bh.length) {return bh[0].getAttribute('src');} else {var zq = document.getElementsByClassName('zq')[0]; return zq.getAttribute('src');}} getURL();"];
    }

    NSString *getTitle = [webView stringByEvaluatingJavaScriptFromString:@"function getTitle() {var jm = document.getElementsByClassName('jm'); if (jm.length) {return jm[0].innerHTML;} else {var lp …
Run Code Online (Sandbox Code Playgroud)

youtube iphone objective-c download

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

在openGL中检测3D对象上的触摸位置

我在为我的一个应用程序创建了一个3D对象.物体就像人体一样,可以在触摸时旋转.如何检测此3D对象上的触摸位置.意味着如果用户触摸头部,我必须检测到它是头部.如果手上有触摸,则必须识别.即使将对象旋转到其他方向,它也应该工作.我认为需要3D对象上的触摸坐标.
这是我在视图上获得触摸位置的方法.

- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
{
    UITouch* touch = [touches anyObject];
    CGPoint location  = [touch locationInView: self];
    m_applicationEngine->OnFingerDown(ivec2(location.x, location.y));
}
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?提前致谢!

iphone 3d opengl-es objective-c

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

使用NFD unicode进行NSString规范化

在我的应用程序中,我必须使用NFD Unicode系统规范化NSString.我怎样才能做到这一点?我需要转换用户输入的字符串作为规范化的字符串,我必须计算一个数字.谁能帮我?

iphone unicode objective-c nsstring unicode-normalization

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

如何为iPhone应用程序创建ipa文件

我建立一个应用程序,使一个IPA文件,但不能ceated.我有版本的Xcode 3.2.6遵循必要使IPA file.But没有希望的步骤.我存档了应用程序并在组织器中打开然后分发它,但它没有显示任何ipa文件正在创建的警报.

iphone xcode

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