小编Mar*_*rco的帖子

如何在UIPopoverController中设置UITableView的背景颜色?

我使用的是iOS SDK 4.2.我有一个用导航控制器初始化的UIPopoverController,它用视图控制器初始化.视图控制器的子视图之一是分组表视图.我想更改表格视图的背景颜色.但是,如果我在视图控制器的viewDidLoad方法中

self.myTableView.backgroundColor = [UIColor blackColor];
Run Code Online (Sandbox Code Playgroud)

当弹出窗口显示时,背景不会改变,表格视图的背景为灰色.任何线索?这种方法有什么问题?先感谢您.

ipad uipopovercontroller ios

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

停止蓝牙GKSession的不相关日志?

如何在GKSession开始搜索时停止以下代码?

 BTM: posting notification BluetoothAvailabilityChangedNotification
2011-05-17 20:25:05.666 BLUConnect[2120:307] BTM: Adding new device 0x110db0 Jahangir Nawaz’s iPhone 00:23:DF:3C:BC:5B 0xf5210003
2011-05-17 20:25:05.669 BLUConnect[2120:307] BTM: _btServiceEventCallback: service = 0xffffffff eventType = 0 event = 0 result = 0
2011-05-17 20:25:06.406 BLUConnect[2120:307] BTM: _btServiceEventCallback: service = 0x800 eventType = 0 event = 1 result = 0
2011-05-17 20:25:06.466 BLUConnect[2120:307] BTM: _btServiceEventCallback: service = 0x800 eventType = 0 event = 11 result = 305
2011-05-17 20:25:06.491 BLUConnect[2120:307] BTM: received BT_SERVICE_CONNECT event type with …
Run Code Online (Sandbox Code Playgroud)

iphone bluetooth gksession ios

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

UIGravityBehavior无效

我正在努力学习UIKit Dynamics.
我创建了一个盒子视图并在其上添加了UIGravityBehavior,但是当我运行Project时没有任何反应!

Viewcontroller.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    UIView* box = [[UIView alloc]initWithFrame:CGRectMake(100, 50, 100, 100)];
    box.backgroundColor = [UIColor blackColor];
    [self.view addSubview:box];
    UIGravityBehavior* gravityBehaviour = [[UIGravityBehavior alloc]init];
    [gravityBehaviour addItem:box];
    UIDynamicAnimator* myAnimator = [[UIDynamicAnimator alloc]initWithReferenceView:self.view];
    [myAnimator addBehavior:gravityBehaviour];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
Run Code Online (Sandbox Code Playgroud)

这是我的视图controller.m文件.
程序有什么问题?

objective-c ios7 uidynamicbehavior

5
推荐指数
2
解决办法
1009
查看次数

为OS X服务器机器人存储的存档在哪里

我正在运行Mavericks Server并使用机器人进行CI.我的一些机器人在运行时会创建一个存档.由于我有一个有限的驱动器空间,我想确保我没有用存档和ipa文件来填充机器.

这些文件存储在哪里,是否可以更改此位置?

xcode osx-server ios

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

在iOS中的UITableView中换行文本

我想在UITableView中包装单元格的文本.我正在使用以下代码,但是现在如何动态更改单元格的高度,单元格的对齐现在不正确?我注意到tableView委托中有一个内置方法 - (CGFloat)cellHeightForRow但我可以动态接收文本并设置高度,因为我的JSON数据中有可变长度的文本

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];  
    if (cell == nil) {  
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];  
    }  
    [cell.textLabel sizeToFit];
    cell = [[[UITableViewCell alloc]
             initWithStyle: UITableViewCellStyleSubtitle
             reuseIdentifier: @"UITableViewCell"] autorelease];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;

    NSDictionary *person = [myPeople objectAtIndex:[indexPath row]]; 

    NSString *name = [person valueForKey:@"name"];
    cell.detailTextLabel.text = [person valueForKey:@"time"];
    return cell; 
}
Run Code Online (Sandbox Code Playgroud)

这是我到目前为止所尝试的:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
     NSDictionary *person = [myPeople objectAtIndex:[indexPath …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

4
推荐指数
1
解决办法
4721
查看次数

iOS 7中的多对等连接传输速度极慢

我试图使用iOS 7中新的多对等连接框架传输2兆字节的数据.我发现发送和接收2兆字节的数据需要至少5分钟.这看起来很奇怪.这是在同一房间的iPhone 5S和iPad 3之间.无论是启用还是禁用WiFi或蓝牙,以及启用/关闭是否可靠,都会出现问题.

// self.session is an open MCSession, packet is the 2 MB of data, reliable is YES or NO, both are slow
[self.session sendData:packet toPeers:peers withMode:MCSessionSendDataReliable error:&error];
Run Code Online (Sandbox Code Playgroud)

ios7 multipeer-connectivity

4
推荐指数
1
解决办法
2542
查看次数

创建自定义MCBrowserViewController

有没有办法创建一个UITableView住房相同的信息MCBrowserViewController?我当前的代码只允许推送与我的app不在同一设计中的标准视图:

self.browserVC = [[MCBrowserViewController alloc] initWithServiceType:@"chat" session:self.mySession];
[self presentViewController:self.browserVC animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?提前致谢!

iphone objective-c uitableview ios7 multipeer-connectivity

4
推荐指数
1
解决办法
3517
查看次数

当app在后台时,我可以将用户的当前位置发送到服务器吗?

当app在后台时,我可以将用户的当前位置发送到服务器吗?例如:在我的应用程序中,我想每隔2分钟存储用户的当前位置,然后将其当前位置发送到服务器.我可以在应用程序处于后台时执行此操作吗?我可以在后台模式下向服务器发送位置更新吗?

iphone core-location ios ios7

4
推荐指数
2
解决办法
6518
查看次数

从UIViewcontroller调用storyboard

我不知道这是否可能,但我使用xib编写了一个项目,并希望以模态方式切换到storyboard项目.

我知道要切换VC,你会做类似的事情

NewViewController *NewVC = [[NewViewController alloc] init];
[self presentModalViewController:NewVC animated:YES];
Run Code Online (Sandbox Code Playgroud)

点击一个按钮,我称之为"开关"

还有另一个项目使用故事板,我想用"开关"调用

我该怎么做呢?是否有可能做到这一点?

modal-dialog storyboard uiviewcontroller ios

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

尝试将indexPath保存到NSUserDefaults时出错

我正在尝试为UICollectionView保存indexPath,但是我收到以下错误:

libc++abi.dylib: terminating with uncaught exception of type NSException
Run Code Online (Sandbox Code Playgroud)

我的代码是:保存索引路径:

[[NSUserDefaults standardUserDefaults] setObject:indexPath forKey:@"CollectionIndex"];
[[NSUserDefaults standardUserDefaults] synchronize];
Run Code Online (Sandbox Code Playgroud)

加载indexPath:

NSIndexPath *storedIndexPath = [[NSUserDefaults standardUserDefaults] objectForKey:@"CollectionIndex"];
Run Code Online (Sandbox Code Playgroud)

我已经注释掉代码以找出导致错误的代码,这是我用来保存创建SIGABRT错误的indexPath的代码.

objective-c nsuserdefaults nsindexpath

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