我试图将一个单元格作为每个单元格之间的空格 - 这将通过设置alpha = 0来隐藏.在我的表格中,空格单元格将用于奇数行.
请注意,实际的单元格高度为85,但隐藏的单元格高度(即单元格之间的空间)为20.
问题是空间单元高度是85,但不是20,我不知道为什么.可能是单元格未正确加载.
Cell这里是UITableViewCell- 实际的单元格 - 标识符为'Cell'.
Cell2 是标识符"Space"的空间.
上面的每个类都有自己的UITableViewCell类,并且XIB文件也分配给它们.该标识符也被在IB为每个XIB设置.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier1 = @"Cell";
static NSString *CellIdentifier2 = @"Space";
Cell *cell = (Cell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if(!cell)
{
NSArray *ar = [[NSBundle mainBundle] loadNibNamed:@"CellView" owner:nil options:nil];
for (id obj in ar)
{
if ([obj isKindOfClass:[Cell class]])
{
cell = (Cell *)obj;
break;
}
}
}
if (indexPath.row % 2 == 1)
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用最新的Facebook iOS SDK 3.0
我需要在登录过程中提供帮助:
首先,我在AppDelegate.h以下位置声明此属性:
@property (nonatomic, strong) FBSession *session;
Run Code Online (Sandbox Code Playgroud)
在ViewController类中我得到这个在代码中使用它,如下所示:
AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.session someproperty];
Run Code Online (Sandbox Code Playgroud)
我在ViewController中也有这个方法从以下方法调用viewDidLoad:
-(void)login
{
AppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.session accessToken];
NSLog(@"%d",delegate.session.isOpen);
if (!delegate.session.isOpen)
{
delegate.session = [[FBSession alloc] init];
if (delegate.session.state == FBSessionStateCreatedTokenLoaded)
{
[delegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
NSLog(@"%d", delegate.session.isOpen); // First Line //////////////////
}];
}
NSLog(@"%@", delegate.session.description); // Second Line //////////////////
}
}
Run Code Online (Sandbox Code Playgroud)
Facebook应用程序获得授权后,第一个NSLog打印零,第二个NSLog表明session状态FBSessionStateCreated不是 …
我有一个带有NSArray对象userID的实现文件
NSArray *userIDs;
NSInteger friendID;
@implementation TableViewController
-(void)reciveFriendsIDs:(NSArray *)array
{
userIDs = [NSArray arrayWithArray:array];
}
-(NSString *)getFriendId
{
return [userIDs objectAtIndex:friendID];
}
.
.
.
@end
Run Code Online (Sandbox Code Playgroud)
并且该方法-(NSString *)getFriendId从另一个类中调用它,如下所示:
TableViewController *tableController = [[TableViewController alloc]init];
NSString *fid = [tableController getFriendId];
Run Code Online (Sandbox Code Playgroud)
但我有一个错误说" - [__ NSArrayI respondsToSelector:]:消息发送到解除分配的实例0x20320200"并且编译器指示此行中的错误:
return [userIDs objectAtIndex:friendID];
Run Code Online (Sandbox Code Playgroud) 正如我们所知道的Facebook SDK,我们应该在App Plist中提供URL类型和FacebookAppID密钥.
我的问题是如何以编程方式存储它们而不必在plist中手动输入它们,就像在UIApplicationDelegate方法中一样didFinishLaunchingWithOptions.
我尝试设置它NSUserDefaults但它继续给出这个错误:
No AppID provided; either pass an AppID to init, or add a string valued key with the appropriate id named FacebookAppID to the bundle *.plist'
Run Code Online (Sandbox Code Playgroud)
我不知道为什么,但我猜Xcode存储密钥使用NSUserDefaults在其他地方默认的应用程序Plist.
有谁知道如何解决这一问题?
我有一些顶部有工具栏的视图控制器,看起来像这样
我如何填充状态栏背景以匹配工具栏背景,以便它匹配新的iOS 7风格?