我有三个NSMutableArray包含根据不同的标准添加到列表中的名称.
这是我的数组伪代码:
NSMutableArray *array1 = [@"Jack", @"John", @"Daniel", @"Lisa"];
NSMutableArray *array2 = [@"Jack", @"Bryan", @"Barney", @"Lisa",@"Penelope",@"Angelica"];
NSMutableArray *array3 = [@"Jack", @"Jerome", @"Dan", @"Lindsay", @"Lisa"];
Run Code Online (Sandbox Code Playgroud)
我想找到第四个数组,其中包括这三个数组的交集.在这种情况下,例如它将是:
NSMutableArray *array4 = [@"Jack",@"Lisa"];
Run Code Online (Sandbox Code Playgroud)
因为所有三个阵列都有jack和lisa作为元素.有没有办法简单地这样做?
我有一个像这样的图像:

当我将图像加载到uiimageview然后作为子视图添加到uiscrollview时,在开始时图像显示如下:

问题是我希望看到所有图像在开始时适合屏幕,但它显示已经缩放.有没有办法处理这个请帮助...
我有这样的代码:
[self.view addSubview:scrollView];
UIImageView *tempImageView =
[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Tree.jpg"]];
self.imageView = tempImageView;
[tempImageView release];
[scrollView setContentMode:UIViewContentModeScaleAspectFit];
[imageView sizeToFit];
scrollView.backgroundColor=[UIColor blackColor];
scrollView.contentSize = imageView.frame.size;
scrollView.minimumZoomScale = scrollView.frame.size.width / imageView.frame.size.width;
scrollView.maximumZoomScale = 4.0;
[scrollView setZoomScale:1.0];
scrollView.clipsToBounds = YES;
scrollView.delegate = self;
[scrollView addSubview:imageView];
Run Code Online (Sandbox Code Playgroud) 我有两个观点.第一个:FirstViewController第二个:SecondViewController
FirstViewController是我的UINavigationController的根控制器,在FirstViewController里面我有UITableView.在UITableView中单击单元格时,视图将导航到SecondViewController.在SecondViewController里面我有UILabel.我想将此UILabel的值分配给在导航栏中单击"返回"按钮时在FirstViewController中单击的单元格.我应该怎么做才能实现这个目标?
我可以通过创建:从FirstViewController传递值到SecondViewController:
SecondViewController*sv; sv.somestring = someanotherstring;
但无法在SecondViewController中实现此功能,以将值传递给FirstViewController中的NSString.
你可以帮我吗?
谢谢.AE
我有一个XML文件,如下所示:
<Statistics>
<City ID="01">
<Town ID="04">
<Person ID="03" Name="Jack">
</Person>
<Person ID="04" Name="John">
</Person>
<Person ID="05" Name="Peter">
</Person>
<Person ID="06" Name="Daniel">
</Person>
</Town>
<Town>
...
</Town>
</City>
<City>
...
</City>
</Statistics>
Run Code Online (Sandbox Code Playgroud)
我想阅读这个XML文件并创建一个城市数组.在城市阵列内部我希望城镇阵列具有给定的ID和城镇阵列内部我希望有一个人员列表,我将在我的项目中使用他们的名字.系统将如下:返回居住在城市中ID =".."的人和ID ="..."的城镇例如:返回居住在CityID ="01"且TownID ="04"的人名单将是[杰克,约翰,彼得,丹尼尔].
有没有在iPhone SDK中这样做的方法?如果有,你可以建议我这样做的方法或解释如何以最简单的方式做到这一点,因为我对这个环境很新.
非常感谢您收到的答案.
iphone ×4
intersection ×1
uiimage ×1
uiimageview ×1
uiscrollview ×1
uitableview ×1
xml ×1
xml-parsing ×1