我试图在我的iPhone应用程序中使用iTunes Affiliate Search API来搜索iTunes Store中的内容.搜索"我想牵着你的手"的示例网址是:
http://itunes.apple.com/search?term=i+want+to+hold+your+hand&entity=song
Run Code Online (Sandbox Code Playgroud)
此搜索会找到标题为"我想牵着你的手"的所有歌曲.但是,我只想找到披头士乐队的歌曲.我尝试了以下内容来缩小搜索范围,但它不起作用:
http://itunes.apple.com/search?term=i+want+to+hold+your+hand&entity=song&term=beatles&entity=musicartist
Run Code Online (Sandbox Code Playgroud)
这只是提供了相同的结果.
如何使用itunes.apple.com/search构建一个URL以查找特定艺术家的歌曲标题
如何按输入顺序输出字典的值是可能的.
例:
我的意见:
[dicValue0 setObject:@"Start Date & Time" forKey:@"START_DATETIME"];
[dicValue0 setObject:@"Specify End" forKey:@"SPECIFY_END"];
[dicValue0 setObject:@"End Date & Time" forKey:@"END_DATETIME"];
[dicValue0 setObject:@"Open End" forKey:@"END_OPEN"];
Run Code Online (Sandbox Code Playgroud)
输出:
我可以编写一个循环,按输入的顺序对输出进行排序.但是,如果我有超过10000个值,这不是最好的和高效的方式.有什么来自苹果,这有助于我解决这个问题吗?
在为较旧的部署目标编译iPhone应用程序时,如何为多个框架指定-weak_framework?
我在我的代码中得到了这个函数:
-(void)printAngle
{
int width = p2_t.x-cp1_t.x;
int height = p2_t.y-cp1_t.y;
if (width != 0) {
CCLOG(@"%i * %i", width, height);
CCLOG(@"%f", (float)atan(height/width)*(180/M_PI));
}
}
Run Code Online (Sandbox Code Playgroud)
下面是输出的片段:
2011-12-06 20:46:52.074 x[12392:c503] 24 * 13
2011-12-06 20:46:52.074 x[12392:c503] 0.000000
2011-12-06 20:46:52.108 x[12392:c503] 25 * 15
2011-12-06 20:46:52.108 x[12392:c503] 0.000000
Run Code Online (Sandbox Code Playgroud)
这意味着arctan(13/24)度数为0.这是不正确的.那我为什么得到0呢?这类型的东西我做错了吗?
它有一些正确的角度:
2011-12-06 20:51:11.956 x[12436:c503] 12 * 129
2011-12-06 20:51:11.957 x[12436:c503] 84.289404
2011-12-06 20:51:11.989 x[12436:c503] 10 * 132
2011-12-06 20:51:11.990 x[12436:c503] 85.601292
Run Code Online (Sandbox Code Playgroud) 我有一个播放视频的MPMoviePlayerController.
我的问题是,视频的尺寸会随着长宽比的变化而变化,因此很多时候视频边界与播放器边界之间存在很大的黑色差距.黑色间隙是水平和垂直的.
有没有办法让我知道实际视频所包含的矩形是什么?然后我可以找出与视频相关的触摸坐标.
我为iPad构建的应用程序有多个文本字段.所以我不得不使用scrollview.我想永久显示滚动条,以便用户知道底部还有一些字段.
我阅读了有关单身人士和授权的足够信息.所以,我想我明白什么是单身人士.关于代表团我仍然感到困惑.我理解授权的概念,但我需要创建我的协议以理解授权.
好的,我创建单例用于与CoreData中的实体一起工作.也许我错了,它不是单身,请告诉我.我的单身人士是FetchData.
Fetchdata.h
#import <Foundation/Foundation.h>
@interface FetchData : NSObject <UIApplicationDelegate>
+(FetchData*) fetchData;
-(NSArray*)fetchLogin:(NSString*)name;
-(BOOL)newGroup:(NSString*)group forLogin:(NSString*)login;
-(NSMutableArray*)contactsForGroup:(NSString*)group;
-(BOOL)newContact:(NSString*)name surname:(NSString*)surname withDatas:(NSArray*)array;
//other methods
@end
Run Code Online (Sandbox Code Playgroud)
Fetchdata.m
#import "FetchData.h"
#import "Contact.h"
#import "Login.h"
#import "Group.h"
#import "AppDelegate.h"
@interface FetchData ()
@property (nonatomic, strong) NSEntityDescription *loginEntity;
@property (nonatomic, strong) NSEntityDescription* groupEntity;
@property (nonatomic, strong) NSManagedObjectContext* context;
@property (nonatomic, strong) NSEntityDescription* contactEntity;
@property (nonatomic, strong) AppDelegate* appDelegate;
//other properties
@end
@implementation FetchData
@synthesize //my properties
+(FetchData*) fetchData
{
static FetchData* fetchData = nil;
if (!fetchData)
fetchData …Run Code Online (Sandbox Code Playgroud) 我已经尝试了几乎所有东西来显示图像,而不是MKMapView上的默认红色图钉.
互联网上有很多关于此问题的答案,但他们都继续给我这个:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
if([annotation isKindOfClass:[MKUserLocation class]])
return nil;
NSString *annotationIdentifier = @"CustomViewAnnotation";
MKAnnotationView* annotationView = [mapview dequeueReusableAnnotationViewWithIdentifier:annotationIdentifier];
if(!annotationView)
{
annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:annotationIdentifier]];
}
annotationView.image = [UIImage imageNamed:@"map_location_pin.png"];
annotationView.canShowCallout= YES;
return annotationView;
}
Run Code Online (Sandbox Code Playgroud)
这根本没有帮助我,它只是一个方法的外观.
请告诉我如何使用它来使方法返回带有自定义图像的注释.几乎所有其他答案告诉我实施该方法,没有进一步的解释.
我在哪里打电话给它?我怎么称呼它?
谢谢!
我的代码播放视频文件有问题.每当我以全屏模式播放文件时,播放都不会占用我的所有屏幕.这是相关代码:
NSURL *url = [NSURL fileURLWithPath:@"Somefile.mov"];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
[moviePlayer setControlStyle:MPMovieControlStyleFullscreen];
[moviePlayer setFullscreen:YES];
moviePlayer.view.frame = self.switchView.frame;
[self.switchView addSubview:moviePlayer.view];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(movieFinishedCallback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(playbackStateDidChange:)
name:MPMoviePlayerPlaybackStateDidChangeNotification
object:moviePlayer];
[moviePlayer prepareToPlay];
[moviePlayer play];
Run Code Online (Sandbox Code Playgroud)
这是我得到的输出:

我有UIScrollView,我以编程方式填充UIImageViews.之后,我更改了scrollview的contentSize,以便我可以滚动它.它工作正常,但我没有看到滚动条,它困扰我.我已设置在.xib中显示它们,我甚至以编程方式设置"showHorizontalScrollIndicator"属性,但我仍然看不到滚动条.
有谁知道为什么我看不到滚动条以及如何让它们出现?
顺便说一下,我并不是说我不想在任何时候看到它们,我只是想要标准的行为,但即使我在滚动它们也不会显示它们.
ios ×8
objective-c ×4
cocoa-touch ×2
iphone ×2
uiscrollview ×2
affiliates ×1
annotations ×1
c ×1
delegates ×1
frameworks ×1
itunes ×1
linker ×1
nsdictionary ×1
singleton ×1
trigonometry ×1
uikit ×1
url ×1
weak-linking ×1
xcode ×1