小编Vin*_*ngh的帖子

使用图形API从Facebook获取用户信息

我想从Facebook获取基本用户信息,但在以下代码中遇到一些问题

-(void)checkForAccessToken:(NSString *)urlString {
    NSError *error;
    NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"access_token=(.*)&" options:0 error:&error];
    if (regex != nil) {
        **NSTextCheckingResult *firstMatch = [regex firstMatchInString:urlString options:0 range:NSMakeRange(0, [urlString length])];
        if (firstMatch) {
            NSRange accessTokenRange = [firstMatch rangeAtIndex:1];
            NSString *accessToken = [urlString substringWithRange:accessTokenRange];
            accessToken = [accessToken stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
            [_delegate accessTokenFound:accessToken];               
        }**
    }
}
Run Code Online (Sandbox Code Playgroud)

在firstMatch中我得到NULL,这就是为什么[_delegate accessTokenFound:accessToken]; 这种方法不会被调用.

任何人都可以帮助我,以便我能够从Facebook用户信息

提前致谢.

iphone facebook fbconnect facebook-graph-api facebook-ios-sdk

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

邀请 Twitter 好友使用应用

我们如何使用我的应用程序邀请我们的 Twitter 朋友/关注者参加任何应用程序/活动。为了在 Facebook 上做同样的事情,我在我的朋友墙上发布了一些消息。有什么方法可以使用 MGTwitterEngine 做同样的事情。

预先感谢

iphone twitter mgtwitterengine ios

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

UITableViewCell中的多个视频播放问题

在我的应用程序中,我正在尝试播放多个视频,UITableViewCell因为我使用MPMoviePlayerController它播放视频没有任何问题.但是它一次播放一个视频而在其他单元格中我得到黑屏,假设第一次有一个单元格可见它播放视频但是当我滚动第二行时,第一个单元格视频视图会随着黑屏消失.即使我滚动表视图,我也无法看到如何使所有视频视图可见.这是我在自定义单元格中播放视频时使用的代码:

Custom Cell初始化:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self){
        NSArray *nibArray=[[NSBundle mainBundle]loadNibNamed:@"CustomCell" owner:self options:nil];
        self=[nibArray objectAtIndex:0];

        _player = [[MPMoviePlayerController alloc] init];
        _player.view.frame = CGRectMake(0,0,320,300);
        _player.movieSourceType = MPMovieSourceTypeStreaming;
        [_player setContentURL:[NSURL URLWithString:@"http://files.parse.com/ef5649ee-75c6-4c76-ba3b-37be4d281125/b35589f7-c0aa-4ca8-9f7c-fd31b2dc8492-vedioTeaser.mov"]];
        [_player prepareToPlay];
        [_player play];
        [self addSubview:_player.view];
    }
    return self;
}
Run Code Online (Sandbox Code Playgroud)

CellForRowAtIndexPath方法

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

    CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell == nil){
        cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; …
Run Code Online (Sandbox Code Playgroud)

iphone mpmovieplayercontroller uitableview ios

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

用平行线填充UIBezierPath

我正在尝试使用UIBezierPath绘制自定义形状:

UIBezierPath *aPath = [UIBezierPath bezierPath];

    [aPath moveToPoint:CGPointMake(100.0, 0.0)];

    // Draw the lines.
    [aPath addLineToPoint:CGPointMake(200.0, 40.0)];
    [aPath addLineToPoint:CGPointMake(160, 140)];
    [aPath addLineToPoint:CGPointMake(40.0, 140)];
    [aPath addLineToPoint:CGPointMake(0.0, 40.0)];
    [aPath closePath];
Run Code Online (Sandbox Code Playgroud)

我想用平行线填充它以使其剥离。我也想更改这些线条的颜色。假设我要使它们垂直。我必须定期计算此路径上的点数,我该怎么做?

我找到了这个UIColor colorWithPatternImage,但是后来我无法更改形状中线条的颜色和“密度”。

iphone cocoa-touch objective-c uikit ios

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