小编Hig*_*ule的帖子

"'BlahDataController'没有可见的@interface声明选择器'aMethod:'"

我的问题的一个简单例子:

"在BlahDataController.h中"

@interface BlahDataController : NSObject
-(NSString *)aMethod:(NSString *)theString;
@end
Run Code Online (Sandbox Code Playgroud)

"在BlahDataController.m中"

#import "BlahDataController.h"
@implementation BlahDataController

-(NSString *)aMethod:(NSString *)theString
{
    return @"Something";
}

@end
Run Code Online (Sandbox Code Playgroud)

"在BobViewController.h中"

@interface BobViewController : NSObject
-(void)aMethodOfSomeSort;
@end
Run Code Online (Sandbox Code Playgroud)

"在BobViewController.m中"

#import "BobViewController.h"
#import "BlahDataController.h"

@implementation BobViewController

-(void)aMethodOfSomeSort
{
    BlahDataController *blahDataController = [[BlahDataController alloc] init];
    NSLog(@"%@",[blahDataController aMethod:@"Variable"]);
}

@end
Run Code Online (Sandbox Code Playgroud)

在"NSLog(@"%@",[blahDataController aMethod:@"Variable"])行上;" 我收到错误:"'BlahDataController'没有可见的@interface'声明选择器'aMethod:'"

有谁知道为什么会出现这个错误?

- = - = - = - = - = - = - = - = - = - = -

问题是,在我的实际程序中,我有相同的实现,它适用于以这种方式创建的数百种方法.但是,每隔一段时间,我就会在新创建的方法上收到此错误.我没有做任何不同的事情.它只是不会认识到它是新创造的存在.

- = - = - …

xcode objective-c ipad

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

如何删除分组UITableView顶部的空白区域?

当您UITableView使用UITableViewStyleGrouped样式创建时,它会在实际的tableviewcells和表格框架的边框之间添加相当多的空间(或"缓冲").这个空间位于tableviewcells的上方,下方,左侧和右侧.

您可以通过以下方式更改tableviewcells之间的空间:

[myTableView setSectionHeaderHeight:0];
[myTableView setSectionFooterHeight:25];
Run Code Online (Sandbox Code Playgroud)

然而,即使通过这样做,在帧的顶部和第一个tableviewcell之间仍然存在这个恼人的空间.此外,框架左侧和桌面单元之间仍有大量空间,框架右侧和桌面单元也是如此.

- = - = - = - = - = - = -

基本上,有没有办法操纵那个空间(调整它的大小)?到目前为止,我唯一的解决方案是使框架的尺寸大于屏幕,以使程序伪造成在屏幕外面具有"空白空间",从而将其移除.然而,这显然不是最佳的并且是明显的黑客攻击.

有什么想法吗?提前致谢!

objective-c uitableview

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

从背景线程中的委托方法更改UILabel的文本不起作用

HomeViewController.h

#import "DataParser.h"
@interface HomeViewController : UIViewController <DataParserDelegate>
{
    UILabel *theLabel;
}
Run Code Online (Sandbox Code Playgroud)

HomeViewController.m

#import "HomeViewController.h"
@implementation HomeViewController
-(void)viewDidLoad
{
    theLabel = [[UILabel alloc] initWithFrame:CGRectMake(200, 200, 100, 30)];
    theLabel.text = @"Bob";
    theLabel.font = [UIFont italicSystemFontOfSize:20.0];
    theLabel.textColor = [UIColor whiteColor];
    theLabel.backgroundColor = [UIColor blueColor];
    [self.view addSubview:theLabel];

    UIButton *theButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [theButton addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
    [theButton setTitle:@"Big Button" forState:UIControlStateNormal];
    theButton.frame = CGRectMake(100,100,200,50);
    [self.view addSubview:theButton];
}
-(void)clicked:(id)sender
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND,0),
    ^{
        DataParser *data = [[DataParser alloc] init];
        data.delegate = self;
        [data loadSomething];

        dispatch_async(dispatch_get_main_queue(),
        ^{ …
Run Code Online (Sandbox Code Playgroud)

objective-c ipad

0
推荐指数
1
解决办法
2208
查看次数

标签 统计

objective-c ×3

ipad ×2

uitableview ×1

xcode ×1