小编Nar*_*lle的帖子

MKAnnotation,简单的例子

有一个简单的示例项目MKAnnotation吗?我不知道该在" addAnnotation" 处传递什么,因为它需要一些" id<Annotation>".开发人员站点上的示例都是数组或解析器左右,我只需要一个非常简单的示例来首先了解整个事情是如何工作的.

提前致谢..

编辑:

我开了一堂课Pin.在.h中写道

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>

@interface Pin : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subTitle;
}

@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, readonly) NSString *subTitle;

- (id)initWithCoordinates:(CLLocationCoordinate2D)location placeName:(NSString *)placeName description:(NSString *)description;
@end
Run Code Online (Sandbox Code Playgroud)

根据onnoweb的回答.

在Pin.m中,我根据不同的例子实现了这样的:

#import "Pin.h"

@implementation Pin

@synthesize title, subTitle;

- (CLLocationCoordinate2D) coordinate {
CLLocationCoordinate2D coords;
coords.latitude = coordinate.latitude; //i want it that way
coords.longitude =  7.1352260; //this way …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c mkannotation

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

通过终端使GitX打开,以便在当前路径上放置仓库

我通常通过terminal命令启动gitx

$ gitx
Run Code Online (Sandbox Code Playgroud)

通常,当我在/ path/to/repo中作为终端中的pwd时,gitx正在打开该存储库日志.我不知道这是更新还是我改变了一些设置,但是从一段时间开始,当我点击命令时,gitx会打开空白.我用Google搜索,找不到.如何让gitx打开目录的repo,我就在那一刻?

谢谢!

terminal gitx

9
推荐指数
2
解决办法
4474
查看次数

MPMoviePlayerController不会自动将旋转更改为横向

嘿,
我确实有我的应用程序与Tabbar导航和其他所有在纵向模式,其中不支持旋转.现在我必须播放这个必须是风景的视频.我正在使用MPMoviePlayerController基本上工作正常,但据说它自动旋转到横向模式,它保持纵向模式.

- (IBAction) openFourthInfo:(id)sender{
NSURL *url = [NSURL URLWithString:@"http://my-video.mp4"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];  

[[NSNotificationCenter defaultCenter] addObserver:self  
                                         selector:@selector(moviePlaybackComplete:)  
                                             name:MPMoviePlayerPlaybackDidFinishNotification  
                                           object:player]; 

[[NSNotificationCenter defaultCenter] addObserver:self  
                                         selector:@selector(userPressedDone:)  
                                             name:MPMoviePlayerWillExitFullscreenNotification  
                                           object:player]; 

[self.view addSubview:player.view];  
[mainView setHidden:YES]; //Need to hide another subview here

player.fullscreen = YES;  
[player play];
}
Run Code Online (Sandbox Code Playgroud)

这就是我称之为播放器的方式.在userPressedDone:moviePlaybackComplete:我基本上只是设置mainView.setHidden = YES;,删除观察者,删除和释放播放器.

没什么特别的.知道为什么玩家会留在肖像中吗?我试过了

[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:YES]; 
Run Code Online (Sandbox Code Playgroud)

它为一个不断变化的状态栏设置了动画,但视图保持不变.通过增加

[[player view] setBounds:CGRectMake(20, 0, 480, 320)];
[[player view] setCenter:CGPointMake(160, 240)];
[[player view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)]; 
Run Code Online (Sandbox Code Playgroud)

什么都没发生.替换player viewself view …

iphone video objective-c orientation

4
推荐指数
1
解决办法
3995
查看次数

告诉iPhone这个特定号码是没有电话号码

这可能是一个相当简单的问题,我认为它比其他任何东西都更有趣,但是我有一个显示本地HTML的webView,其中有一本书的ISBN号,而iPhone将它作为电话号码链接并询问我是否我想打个电话.
我如何告诉它不要将它用作电话号码?

(这个数字是p-tag里面的纯文本,它没有链接到亚马逊等......)

html objective-c phone-number uiwebview ios

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

UIButton具有不同字体大小的标题和副标题

我需要一个UIButton显示两行文本,其中第一行作为标题,第二行作为某种字幕,所以它应该是一个较小的字体大小.到现在为止,我的按钮有两行,自定义字体,标题/副标题的内容来自UILabel每个.

UIFont *displayFont = [UIFont fontWithName:@"Chalkboard" size:15];
NSString *buttonLabel;
UILabel *headline = [[UILabel alloc] init];
headline.text = @"This is the title";
UILabel *subtitle = [[UILabel alloc] init];
subtitle.text = @"this is the sub";

buttonLabel = [NSString stringWithFormat:@"%@\n%@", headline.text, subtitle.text];
[openDetail.titleLabel setLineBreakMode:UILineBreakModeWordWrap];
[openDetail setTitle:buttonLabel forState:UIControlStateNormal];
[openDetail.titleLabel setTextAlignment:UITextAlignmentCenter];
openDetail.titleLabel.font = displayFont;
Run Code Online (Sandbox Code Playgroud)

我试图将标签本身设置为displayFont,所以我可以制作第二个UIFont,制作它的副标题.不幸的是,按钮标签将不是这种字体,如果我保持其余如上所示,但将切换回Arial,我认为它是,并且根本没有改变字体大小.

知道如何在第二行中实现更小的字体大小吗?

字体的问题:我将Chalkboard.ttc添加到我的资源中,并将其作为我的info.plist中的条目添加为"应用程序提供的字体".不过,如果我尝试在IB中设置字体,我将显示另一种字体(非常类似于Helvetica).我现在必须以编程方式设置每个按钮字体吗?

iphone objective-c line-breaks font-size uibutton

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

Tabbar中的自定义字体

嘿,
有没有办法将tabbar的字体设置为例如Chalkboard?我已经看到了字体大小的问题,并尝试使用字体,但循环不会有效.

如果无法使用自定义字体,是否可以删除所有文本并使tabbar的项目覆盖整个选项卡?或者我可以以某种方式将imageView放在标签栏的顶部并使用标签"通过"该图像?

谢谢!

iphone fonts objective-c uitabbarcontroller

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

如何阻止单元格缩进 - shouldIndentWhileEditingRowAtIndexPath无效

我有一个带有自定义单元格的普通(未分组)tableView,当我点击"编辑"按钮时,单元格缩进.我不希望这样,我希望删除标志位于我的单元格顶部.

我试过了shouldIndentWhileEditingRowAtIndexPath以及cell.shouldIndentWhileEditin = NO; 以及cell.indentionLevel = -3,但两者都没有任何效果.知道为什么吗?

这可能是由于我的设置?我按照这个教程,我也尝试了像戴维德这样建议的设置,但最后一次不仅使我的细胞缩进,它更糟糕,因为细胞缩进,当我按完成时...我不能得到背景图像覆盖整个细胞......

那么,任何人都知道如何停止普通桌面视图中的自定义单元格,同时仍然显示删除和移动标志?

//编辑:顺便说一句,我在IB中构建自定义单元格.我可以拿走"编辑时缩进"的复选标记,它并不关心.我可以改变压痕水平和宽度的值,没有效果.如果我更改编辑附件,它会愉快地显示它.希望有所帮助..

谢谢!

iphone objective-c uitableview custom-cell

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