如何使用来自不同 ViewController 的 JSON 响应填充 UITableView?

2024-03-05

我在 stackoverflow.com 上进行了谷歌搜索,但无法摆脱这种情况,如何使用 GET 的响应来填充 TableView。我发送 GET 并在 DetailViewController (我的主控制器)中的方法中解析响应,并希望使用响应的一部分初始化 TableViewCell,并使用另一部分初始化该单元格的详细信息。我创建了messageTableView and messageDetailViewController..如果问题不够清楚,我也可以分享代码。谢谢

EDIT我知道这不是所希望的,但我共享了所有代码,因为我无法在 viewController 之间绑定变量,我可以在视图之间导航,但我无法在彼此之间共享变量。

这是我的 DetailViewController 的界面文件(在我的应用程序中,它是主视图控制器)

#import <UIKit/UIKit.h>

@interface BNT_1DetailViewController : UIViewController <UISplitViewControllerDelegate>
{
    NSMutableArray *buttons;
    NSString *userName, *password, *serverIP;
    NSDictionary *mess;
    IBOutlet UITextField *userNameF;
    IBOutlet UITextField *passwordF;
    IBOutlet UITextField *serverF;
    NSURL *url;
    NSMutableArray *mesag;
    IBOutlet UIButton *acceptButton;
    NSMutableArray *mesID; //saving meesage ID s to NSMutableArray
    NSMutableArray *content; 

}
@property(retain,nonatomic)NSMutableArray *mesID,*content;
@property(assign,nonatomic)NSMutableArray *mesag ;
@property(retain, nonatomic)NSDictionary *mess;
//@property (retain,nonatomic)  NSMutableArray *buttons;
@property (retain, nonatomic) UITextField *userNameF;
@property (retain, nonatomic) UITextField *passwordF;
@property (retain, nonatomic) UITextField *serverF;
@property (retain, nonatomic) UIButton *acceptButton;
@property (retain, nonatomic) NSString *userName, *password, *serverIP;
@property (strong, nonatomic) id detailItem;
@property(retain,nonatomic)NSURL *url;
@property (strong, nonatomic) IBOutlet UILabel *detailDescriptionLabel;

-(IBAction)acceptAct:(id)sender;
-(IBAction)readMessages:(id)sender;
-(IBAction)secondAct:(id)sender;
@end

这是它的实现文件:

#import "BNT_1DetailViewController.h"
#import "mainMenu.h"
#import "messages.h"
@interface BNT_1DetailViewController ()
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
- (void)configureView;
@end

@implementation BNT_1DetailViewController
@synthesize content,mesID,url;
@synthesize mesag,mess;
@synthesize userNameF, passwordF, serverF, acceptButton;
@synthesize userName, password, serverIP;
@synthesize detailItem = _detailItem;
@synthesize detailDescriptionLabel = _detailDescriptionLabel;
@synthesize masterPopoverController = _masterPopoverController;

-(IBAction)readMessages:(id)sender{

    messages *message=[[messages alloc]initWithNibName:@"messages" bundle:nil];
    /*
     message.mesid=mesID;
     message.contents=content;
     */
    [self.navigationController pushViewController:message animated:TRUE];




}
-(IBAction)acceptAct:(id)sender{


    userName=[[NSString alloc] initWithString:userNameF.text ];
    [userNameF setText:userName];
    NSUserDefaults *userNameDef= [NSUserDefaults standardUserDefaults];
    [userNameDef setObject:userName forKey:@"userNameKey"];
    password =[[NSString alloc] initWithString:passwordF.text];
    [passwordF setText:password];
    NSUserDefaults *passDef=[NSUserDefaults standardUserDefaults];
    [passDef setObject:password forKey:@"passwordKey"];
    serverIP=[[NSString alloc] initWithString: serverF.text];
    [serverF setText:serverIP];
    NSUserDefaults *serverDef=[NSUserDefaults standardUserDefaults];
    [serverDef setObject:serverIP forKey:@"serverIPKey"];
    [userNameDef synchronize];
    [serverDef synchronize];
    [passDef synchronize];


    UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"BNTPRO "
                                                      message:@"Your User Informations are going to be sent to server. Do you accept?"
                                                     delegate:self
                                            cancelButtonTitle:@"OK"
                                            otherButtonTitles:@"Cancel",  nil];
    [message show];

}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    NSString *title = [alertView buttonTitleAtIndex:buttonIndex];

    if([title isEqualToString:@"OK"])
    {
        if([userNameF.text isEqualToString:@""]|| [passwordF.text isEqualToString:@""] || [serverF.text length]<6) 
        {
            UIAlertView *message1 = [[UIAlertView alloc] initWithTitle:@"BNTPRO "
                                                               message:@"Your User Informations are not defined properly!"
                                                              delegate:nil
                                                     cancelButtonTitle:@"OK"
                                                     otherButtonTitles:  nil];

            [message1 show];
            [userNameF  resignFirstResponder];
            [passwordF resignFirstResponder];
            return;
        }
        mainMenu *ma=[[mainMenu alloc]initWithNibName:@"mainMenu" bundle:nil];
        NSString *str1=[@"?username=" stringByAppendingString:userNameF.text];
        NSString *str2=[@"&password=" stringByAppendingString:passwordF.text];
        NSString *str3=[str1 stringByAppendingString:str2];
        NSString *str4 =[@"http://" stringByAppendingString:serverF.text];


       url=[NSURL URLWithString:[str4 stringByAppendingString:[@"/ipad/login.php" stringByAppendingString:str3]]];
        //get the url to jsondata
        NSData *jSonData=[NSData dataWithContentsOfURL:url];

        if (jSonData!=nil) {
            NSError *error=nil;
            id result=[NSJSONSerialization JSONObjectWithData:jSonData options:
                       NSJSONReadingMutableContainers error:&error];
            NSLog(@"%@",result);       

            if (error==nil) {
            mess=[result objectForKey:@"message"];
                NSDictionary *messContent=[mess valueForKeyPath:@"message"];
                NSDictionary *messID=[mess valueForKeyPath:@"ID"];
                NSString*key1=[ result objectForKey:@"key" ];                
                NSString *s1=[@"http://" stringByAppendingString:serverF.text];
                NSString *s2=[s1 stringByAppendingString:@"/ipad/button.php"];
                NSURL *url2=[NSURL URLWithString:[s2 stringByAppendingString:[@"?key=" stringByAppendingString:key1]]];

                NSData *data2=[NSData dataWithContentsOfURL:url2];
                id result2=[NSJSONSerialization JSONObjectWithData:data2 options:NSJSONReadingMutableContainers error:nil];

                mesID = [NSMutableArray array];//saving meesage ID s to NSMutableArray
                content = [NSMutableArray array];    
                for ( mesag in mess) {

                    //i want to populate TableViewCells with the messID and the details of each cell(push in new view controller) will contain 'content' above

                  /*
                     [mesID addObject:[mesag objectForKey:@"ID"]];
                     [content addObject:[mesag objectForKey:@"message"]];    
                     */    
                    [[NSUserDefaults standardUserDefaults] setObject:messID forKey:@"message"];
                    [[NSUserDefaults standardUserDefaults] setObject:messContent forKey:@"messContent"];

                    // NSLog(@"%@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);
                    //   NSLog(@"The Message with ID %@ is: %@\n",messID,messContent);

                }

                NSLog(@"MessID: %@",mesID);
                NSLog(@"Context: %@",content);


                buttons = [NSMutableArray array];
                CGFloat yPosition = 60.0f;
                CGFloat xPosition = 40.0f;

                const CGFloat buttonHeight = 75.0f;
                const CGFloat buttonMargin = 50.0f;
                UIButton *bt=[UIButton buttonWithType:UIButtonTypeRoundedRect];

                [bt setTitle:@"Messages" forState:UIControlStateNormal];
                [bt addTarget:self action:@selector(readMessages:) forControlEvents:UIControlEventTouchUpInside];
                bt.titleLabel.font=[UIFont systemFontOfSize:25];
                bt.frame=CGRectMake(300.0f, 700.0f,180.0f , 70.0f);
                [ma.view addSubview:bt];

                for(NSDictionary* buttonData in result2) { 
                    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
                    NSString* buttonTitle = [buttonData objectForKey:@"name"];
                    NSString* buttonID=[buttonData objectForKey:@"ID"];
                    [button setTitle:buttonTitle forState:UIControlStateNormal];
                    [button setTag:[buttonID intValue]];
                    button.titleLabel.font=[UIFont systemFontOfSize:28];
                    button.frame = CGRectMake(xPosition, yPosition, 210.0f, buttonHeight);
                    [button addTarget:self action:@selector(secondAct:) forControlEvents:UIControlEventTouchUpInside];
                    [ma.view addSubview:button];
                    //   [v.buttons addObject:button];

                    xPosition = 260.0f;
                    yPosition+= buttonHeight + buttonMargin;

                }


            [self.navigationController pushViewController:ma animated:TRUE];


}
        }} }


-(IBAction)secondAct:(id)sender{

    NSLog(@"ABC: %d",[sender tag]);

}

- (void)dealloc
{
    [_detailItem release];
    [_detailDescriptionLabel release];
    [_masterPopoverController release];
    [super dealloc];
}

#pragma mark - Managing the detail item

- (void)setDetailItem:(id)newDetailItem
{
    if (_detailItem != newDetailItem) {
        [_detailItem release]; 
        _detailItem = [newDetailItem retain]; 

        // Update the view.
        [self configureView];
    }

    if (self.masterPopoverController != nil) {
        [self.masterPopoverController dismissPopoverAnimated:YES];
    }        
}

- (void)configureView
{
    // Update the user interface for the detail item.

    if (self.detailItem) {
        self.detailDescriptionLabel.text = [self.detailItem description];
    }
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [passwordF setSecureTextEntry:YES];
    userNameF.font=[UIFont systemFontOfSize:24];

    userNameF.frame = CGRectMake(320.0f,60.0f,360.0f,50.0f);
    passwordF.frame = CGRectMake(320.0f,145.0f,360.0f,50.0f);
    serverF.frame= CGRectMake(320.0f,235.0f,360.0f,50.0f);
    userNameF.font=[UIFont boldSystemFontOfSize:24];
    [userNameF becomeFirstResponder];
    serverF.font=[UIFont boldSystemFontOfSize:24];
    passwordF.font=[UIFont systemFontOfSize:24];


    acceptButton.titleLabel.font=[UIFont boldSystemFontOfSize:26];
    // Do any additional setup after loading the view, typically from a nib.
    [self configureView];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = NSLocalizedString(@"Detail", @"Detail");
    }
    return self;
}

#pragma mark - Split view

- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController
{
    barButtonItem.title = NSLocalizedString(@"Master", @"Master");
    [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
    self.masterPopoverController = popoverController;
}

- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
    // Called when the view is shown again in the split view, invalidating the button and popover controller.
    [self.navigationItem setLeftBarButtonItem:nil animated:YES];
    self.masterPopoverController = nil;
}

@end

我想用messID填充TableViewCells,每个单元格的详细信息(推入新视图控制器)将包含上面的“内容”

这是我的TableViewController文件名为消息: (.h 文件)

#import <UIKit/UIKit.h>

@interface messages : UITableViewController{

    NSMutableArray *mesid,*contents; 

}

@property(retain,nonatomic)NSMutableArray *mesid,*contents;


@end

和 .m 文件:

#import "messages.h"
#import "messageDetail.h"
@implementation messages
@synthesize mesid;
- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
     self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
     self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (void)viewWillAppear:(BOOL)animated
{
    }

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.

   return [mesid count];
}

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

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }
    cell.textLabel.text=[mesid objectAtIndex:indexPath.row];
    [tableView reloadData]; 
    // Configure the cell...

    return cell;
}


// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}



// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}


/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.

     messageDetail *detailViewController = [[messageDetail alloc] initWithNibName:@"messageDetail" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:detailViewController animated:YES];
     detailViewController.title=@"Message Detail";
     [detailViewController release];

}

@end

我的最后一个控制器是 messageDetails。其接口文件为:

#import <UIKit/UIKit.h>

@interface messageDetail : UIViewController

@end

最后一个,messageDetail 的实现文件:

#import "messageDetail.h"

@implementation messageDetail

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return YES;
}

@end

我快速浏览了一下就发现了几个问题: 1. 你有一个 UITableViewController 的实例。 UITableViewController 的正确初始化是initWithStyle:用它代替。否则你需要做一些额外的工作,而且确实没有必要。 2. 您正在检查按钮中的字符串UIAlertView实例。我的建议是不要这样做。字符串在某种程度上是不稳定的。多语言可以作为一项功能插入,之后您可能会遇到问题。检查索引。这是一个简单的 int,不是令人头痛的警报! 3. 您已设置NSMutableArray作为您的财产messages班级。你为什么不填充它。这就是为什么信息没有出现在您的表格中:因为您没有将其提供给特定的班级。 从控制器中,您正在初始化控制器(包含表视图的类),提供原始控制器中的内容。

建议: 4. 为了标准化,用大写字母命名类,用小写字母命名变量。常量应以“k”字母开头。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用来自不同 ViewController 的 JSON 响应填充 UITableView? 的相关文章

  • 更改 UINavigationBar 中 UIBarButtonItem 的位置

    如何更改 UIBarButtonItem 在 UINavigationBar 中的位置 我希望我的按钮比正常位置高约 5 像素 此代码为 UINavigationBar 创建一个具有图像背景和自定义位置的后退按钮 诀窍是创建一个中间视图并修
  • Jackson Json 将对象反序列化为列表

    我正在使用 Spring 的 Web 服务RestTemplate并反序列化Jackson 在来自服务器的 JSON 响应中 其中一个字段可以是对象或列表 这意味着它可以是 result or result 有没有办法通过对我要反序列化的类
  • iphone navigationController :在退出当前视图之前等待 uialertview 响应

    我有一个带有由导航控制器管理的后退按钮的视图 我想在用户单击后退按钮时检查文件是否已保存 如果文件已保存 您将返回到上一个视图 否则 uialertview 会询问您是否要保存文件 所以我这样做了 但视图消失了 然后警报视图出现了 void
  • 如何使用基于 Spring MVC 注解的 Portlet 控制器通过 AJAX 呈现 JSON 视图/响应?

    在过去的六个小时里 我在 Google 和 stackoverflow 上搜索了这个问题的答案 我最初是一名 PHP 开发人员 所以请耐心等待 从 PHP 控制器返回 JSON 数组非常简单 我正在使用 Spring MVC 3 0 我只想
  • 嵌套对象的 AJV 模式验证

    函数返回的对象看起来像这样 answer vehicle type 1 message Car model VW color red 答案 对象始终存在 其他字段基于 vehicle type E g 如果vehicle type 1 则有
  • stringFromDate 始终为 NIL

    我知道这是一个重复的问题 但是在 stackoverflow 和 google 上搜索了许多类似的问题后 没有一个解决方案对我有用 我正在尝试将从数据库收到的日期转换为字符串格式以在 iPhone 应用程序中显示 我正在按以下方式将日期转换
  • Scala 2.10,它对 JSON 库和案例类验证/创建的影响

    显然 在 Scala 2 10 中我们得到了改进的反射 这将如何影响 lift json jerkson sjson 和朋友 此外 我们能否期望在不久的将来 Scala 中会出现内置的 JSON 语言功能 如 Groovy 的出色 GSON
  • UITableView 自动调整行大小约束在 iPhone 6Plus 上神秘破坏

    我有一个自定义的 UITableViewCell 它有一个缩略图和一堆文本 行高配置为使用自动计算 tableView estimatedRowHeight 129 tableView rowHeight UITableViewAutoma
  • 确定第三方应用程序在 iPhone 上播放的歌曲

    我正在尝试确定 iPhone 上当前正在播放的歌曲的标题 我知道如果本机 Apple 应用程序正在播放音乐 我可以使用以下代码来找出正在播放的内容 但如果从 Spotify 或其他音乐播放应用程序播放歌曲 我如何找到歌曲的标题 MPMedi
  • iPhone中的异步for循环

    for循环看起来像这样 我在视图中编写的确实加载了 因此加载此页面需要更多时间 for int i 3 i lt dataDict objectForKey rss objectForKey channel objectForKey ite
  • 通过 MQTT 将 LoRa 测量结果发送到 Fiware IOT 代理

    我有 LoRa 传感器 它使用 Cayenne LPP 格式有效负载发送测量值 我的网关 LOrank8v1 捕获这些数据包并将其转换为 UDP 网关中有一个服务 lora gateway bridge 它将数据包从 UDP 转换为 TCP
  • 如何检查 uiviewcontroller 是否存在于 uinavigationcontroller 堆栈中

    我有一个UINavigationController 我必须从 a 中弹出一个视图UINavigationController并将其替换为另一个视图 我们如何才能搜索到一个UIViewController对象并将其替换为另一个 当我打印时
  • 一种简单、干净的方式来切换/交换视图?

    我已经看了几个来源 但我仍然很困惑 我想创建一个具有多个视图的应用程序 只有标准视图 没有表视图或其他任何内容 我可以在其中单击每个视图上的按钮来访问其他视图 我已经看到了多种方法来做到这一点 但对我来说唯一有意义的方法是让应用程序委托负责
  • 如何创建适用于 iPhone、iPad 和 Android 的 Extjs 应用程序?

    有人成功创建了适用于 iPhone iPad 和 Android 的 Extjs 应用程序吗 我知道 Sencha 不支持移动设备上的 Extjs 但我不想创建另一个仅针对移动设备的网站 我不需要奇特的移动界面 只需要基本的功能 我做了一些
  • Iphone 上的 Javascript 日期解析

    我正在开发一个针对移动设备的离线 Javascript 网站 iPhone 就是这样的一种移动设备 我正在尝试从 REST API JSON 对象的成员 解析日期 我在用着 Date parse 2010 03 15 10 30 00 这适
  • 如何在 iphone 和 ipad 的通用应用程序中调用 [[UIScreen mainScreen] 缩放]

    我正在制作一个可以在 ipad 和 iphone 上运行的通用应用程序 到目前为止一切顺利 但我刚刚将我的 SDK 更新到 ios4 并且想要调用 UIScreen mainScreen scale scale 不在 3 2 sdk 中 并
  • 您可以使用 JSONP 检索您的 Skype 状态吗?

    有谁知道使用 JSONP 获取 Skype 状态的 URL 到目前为止我只找到了一个 XML 状态 URL http mystatus skype com username xml 我正在尝试使用 AJAX 查询 Skype 是的 我可以使
  • 如何在没有 Xcode 的情况下提交 iOS 应用程序?

    我是一名合同开发商 我已经为客户编写了一个应用程序 是的 使用 Xcode 现在我们准备发货了 我想向他发送一份应用程序副本 他可以签署该副本并将其提交到 iTunes 应用程序商店 但是他没有或没有使用 Xcode 虽然这是一个备份计划
  • 无法读取解析推送通知包数据

    我尝试使用 Parse 推送通知服务发送自定义数据 但从 Bundle 中提取时总是返回 null 值 自定义广播接收器 Override public void onReceive Context context Intent inten
  • iOS 中的视频可以进行反卷积吗?

    我想拍摄击球手挥动棒球的镜头 但球棒很模糊 视频为 30 fps 通过研究 我发现反卷积似乎是最小化运动模糊的方法 但我不知道是否或如何在我的 iOS 应用程序后处理中实现它 我希望有人能给我指出正确的方向 比如如何在 iOS 中应用反卷积

随机推荐

  • 我正在尝试使用 4 路循环展开来优化此 C 代码

    我想做的是获取此 C 代码并使用称为循环展开的技术对其进行优化 但在本例中我想使用四路循环展开 现在 我理解了这项技术 也理解了这个概念 但我只是不知道如何将其应用到这段代码中 我需要添加一些额外的变量吗 我是否必须在每个循环之后或所有循环
  • java.lang.IllegalArgumentException:如果指定的 JWT 是数字签名的,则必须指定签名密钥

    我正在寻求实施JWT在我的申请中 我正在通过参考以下内容进行一些研发 https stormpath com blog jwt java create verify https stormpath com blog jwt java cre
  • 使用自定义 http.ResponseWriter 根据代理请求的响应写入 cookie?

    我原来的问题here https stackoverflow com questions 58776775 how can i set a cookie based on response header with reverse proxy
  • 使用 Java 将十六进制转储的字符串表示形式转换为字节数组?

    我正在寻找一种将表示十六进制值的长字符串 来自转储 转换为字节数组的方法 我无法比发帖者更好地表达它同样的问题在这里 http www experts exchange com Programming Programming Languag
  • 使用方法初始化常量变量 (C#)

    是否可以使用另一个类的方法初始化常量值 namespace ConsoleApplication1 class Program const int gravit haha habc something like this static vo
  • 弹性盒/网格布局中的最后一个边距/填充折叠

    我有一个项目列表 我正在尝试使用 Flexbox 将其排列成可滚动的水平布局 容器中的每个项目都有左右边距 但最后一个项目的右边距正在折叠 有没有办法阻止这种情况发生 或者有一个好的解决方法 ul list style type none
  • Laravel 中使用 return 重定向到外部 URL

    我正在尝试使用 SMS INDIA HUB API 向用户发送一次性密码 为此 我需要重定向到 URL 格式 如果我们加载这个 URL 它将返回一些消息 我需要把这条消息传达给 我试过这样 url http cloud smsindiahu
  • 当我在分析模式下运行我的应用程序时,它停止响应

    我的 Android 应用程序在长时间运行的会话中遇到一些 OutOfMemory 错误 为了找到原因 我尝试使用 Android Studio Profiler 但它停止工作并在使用后 10 秒内冻结应用程序 这是 Android Stu
  • 如何在 URL 中传递 Javascript 变量?阿贾克斯

    我试图在我使用的 url 中传递 accesstoken 和 pageid 的值 有什么想法如何正确地做到这一点吗
  • 文档中哪里说 while 测试 readdir 的定义?

    也可以看看 readdir 的 0 结果在 while 条件下如何不为 false https stackoverflow com questions 843430 how is 0 result from readdir not fals
  • VarBinary 到图像 url

    我正在将 Base64 图像转换为byte 并将其存储在varbinarySQL Server 中的列 我想从数据库获取图像并将其设置为 ASP NET 的图像 urlimage 我怎样才能做到这一点 将图像写入数据库的代码 string
  • 在不同行上选择满足不同条件的值

    假设我有一个像这样的两列表格 userid roleid 1 1 1 2 1 3 2 1 我想获得所有不同的用户 IDroleids1 2 AND 3 使用上面的示例 我想要返回的唯一结果是userid1 我该怎么做 好吧 我对此投了反对票
  • 使用 wingrep 搜索 IP 地址

    我正在使用 WinGrep 在 txt 文件中搜索 IP 地址 但我不知道如何让它使用正则表达式进行搜索 有人对这个有经验么 如果您不需要考虑 IPv6 只需要没有端口号的数字 IP 地址 并且不需要验证地址 即不匹配非法地址行321 45
  • Spring MVC 控制器返回 HTML

    我在尝试将 HTML 返回到 Spring MVC 控制器时遇到问题 它看起来像这样 RequestMapping value QUESTION GROUP CREATE URL method RequestMethod POST publ
  • Node.js 上的多个服务器

    我需要在同一个 Nodejs 实例上模拟四个服务器 具有不同的主机和端口 一个例子可以是 域1 8000 域2 8010 域名3 8020 域4 8030 有人可以帮我吗 谢谢 我添加了一个示例 其中包含使用节点的 2 个服务器的可能解决方
  • Java 8 中的多个 null 检查

    我有下面的代码 对于多个空检查来说有点难看 String s null if str1 null s str1 else if str2 null s str2 else if str3 null s str3 else s str4 所以
  • Scala 类型系统的优点

    我正在探索 Scala 语言 我经常听到的一个说法是 Scala 有一个stronger类型系统优于 Java 我认为人们的意思是 scalac拒绝某些有缺陷的程序javac会愉快地编译 只会导致运行时错误 某些不变量可以在 Scala 程
  • Windows批处理文件:多个if条件

    有没有办法说类似的话 if 1 1 or 1 2 在批处理文件中 或者 如果我可以指定一组候选值 例如 if 1 in 1 2 3 4 20 事实证明 and 很简单 只是不是你期望的语法 这3个例子就说明了这一点 换句话说 If 1 1
  • iPhone - UIImageView 中的中心 UIImage

    我有一个 UIImageView 我从 URL 获取 UIImage 图像显示在 UIImageView 中 但我无法使其正确居中 UIImage 为 80 x 68 像素 UIImaveView 的大小为 90 x 90 当我在 UIIm
  • 如何使用来自不同 ViewController 的 JSON 响应填充 UITableView?

    我在 stackoverflow com 上进行了谷歌搜索 但无法摆脱这种情况 如何使用 GET 的响应来填充 TableView 我发送 GET 并在 DetailViewController 我的主控制器 中的方法中解析响应 并希望使用