小编Irf*_*fan的帖子

如何计算通过cellForRowAtIndexPath中的开关设置的单元格的heightForRowAtIndexPath.

我设置我的单元格如下:

因此,一些开关定义单元格,因为数据不在对象列表中,而是一组信息,应以某种不同的方式显示在tableView中.

-(UITableViewCell *)value1CellForTableView:(UITableView *)tableView {
    static NSString *CellIdentifierValue1 = @"Value1Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifierValue1];

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifierValue1];
        cell.detailTextLabel.textAlignment = UITextAlignmentLeft;
        cell.textLabel.textAlignment = UITextAlignmentLeft;
    }
    return cell;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;

    switch (indexPath.section) {
        case 0:
            //Coupon
            switch (indexPath.row) {
                case 0:
                    //Couponcode
                    cell = [self value1CellForTableView:tableView];
                    cell.textLabel.text = @"Code";
                    cell.detailTextLabel.text = presentedCoupon.couponNr;
                    break;
                case 1:
                    //Coupondescription
                    cell = [self value1CellForTableView:tableView];
                    cell.detailTextLabel.text = …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview ios

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

无法编辑的UITableViewCell y偏移量

我有一个UIViewController需要两个单独的表视图.

我使用storyboard拖动两个表视图到我的控制器,但一旦我将一个表视图细胞在他们每个人的,表中的一个内原型细胞意见忽然有较大y-offset距离的顶部tableView.

当我去检查大小为单元格,然后在视图部分,所有的X,Y,宽度和高度值是灰色的,所以我不能编辑该单元格的位置.

这仅是一个问题,当视图控制器嵌入导航控制器.

为修复这个任何想法弥补,所以我的表不看傻彼此相邻?

objective-c storyboard offset uitableview ios

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

推送通知:didFailToRegister和didRegister委托都没有调用

我正在创建一个支持推送通知的应用程序
我正在执行所有步骤.

它在模拟器上给出错误

Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3010 "remote notifications are not supported in the simulator" UserInfo=0x5813d20 {NSLocalizedDescription=remote notifications are not supported in the simulator}
Run Code Online (Sandbox Code Playgroud)

但是在设备上它没有调用委托方法

didFailToRegisterForRemoteNotificationsWithError  
didRegisterForRemoteNotificationsWithDeviceToken  
Run Code Online (Sandbox Code Playgroud)

我的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

    NSLog(@"application didFinishLaunchingWithOptions");
    // Override point for customization after application launch.

    self.window.rootViewController = self.viewController;
    [self.window makeKeyAndVisible];
    return YES;
}

-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    NSLog(@"My Token is %@",deviceToken);
}

-(void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
    NSLog(@"Failed to get token, …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c apple-push-notifications ios

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

将数据从一个ViewController发送到另一个ViewController.

我有两个ViewController:

1)ViewController

2)TestAppViewController

ViewController.h,我定义了一个标签,我希望从第二个viewController发送其文本,即`TestAppViewController.

为此,我@property NSString *ViewController.h中定义了一个,并在我的第二个Controller中创建了一个ViewController的对象.然后将值传递给此属性,但ans仍然是零.

以下是我的代码:

@property (nonatomic, retain) NSString *lableName;*
Run Code Online (Sandbox Code Playgroud)

视图控制器

#import "ViewController.h
#import "TestAppView1.h"
#import "TestAppViewController2.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //    [self addView1];
}

- (void)viewWillAppear:(BOOL)animated
{ 
    [self addView1];

    NSLog(@"Label name is %@",self.lableName);
}    

- (void)didReceiveMemoryWarning
{
   [super didReceiveMemoryWarning];
   // Dispose of any resources that can …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c callback viewcontroller ios

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

iOS 上的 HTML 电子邮件签名 - 图像未显示。

我使用通常的表格和内联样式创建了一个 HTML 电子邮件签名。

还有一个徽标的图像附件。它在所有电子邮件客户端中完美显示。

但是,当我尝试制作 iPhone/iPad 签名时,我遇到了问题:

图像显示正常,几个小时后就会消失,而是显示一个带有十字的小盒子。

有没有人知道为什么会这样?

html iphone signature html-email ios

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

可以在CGContextSetRGBFillColor中给出不同的颜色吗?

我怎样才能给颜色HEXCOLOR(0xe3f3fbff)CGContextSetRGBFillColor

iphone objective-c uicolor ios

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