我正在尝试设计一个应用程序的界面,我只想让用户按一次UIButton来获得结果.按下按钮后有什么办法可以锁定按钮吗?只有在按下另一个按钮时才释放锁定?
谢谢
当我使用下面的代码从iphone加载相册时,我遇到了问题.虽然我装的很完美,但第一张照片出现的却是最古老的照片.是否可以重新排列顺序,以便我可以先获取最新的照片,然后是时间,最后的是后面的照片?
- (IBAction)imageFromAlbum:(id)sender
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentViewController:imagePicker animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud) 我希望我的循环progressView有一个动画,下面的代码.我希望动画开始从0到我想要的值的进度.但我永远无法让动画工作.
func Popular(){
let circle = Pop;//Pop is a UIView
circle.bounds = CGRect(x: 0,y: 0, width: 100, height: 100);
circle.frame = CGRectMake(0,0, 100, 100);
circle.layoutIfNeeded()
var progressCircle = CAShapeLayer();
let centerPoint = CGPoint (x: circle.bounds.width / 2, y: circle.bounds.width / 2);
let circleRadius : CGFloat = circle.bounds.width / 2 * 0.83;
let circlePath = UIBezierPath(arcCenter: centerPoint, radius: circleRadius, startAngle: CGFloat(-0.5 * M_PI), endAngle: CGFloat(1.5 * M_PI), clockwise: true );
progressCircle = CAShapeLayer ();
progressCircle.path = circlePath.CGPath;
progressCircle.strokeColor = UIColor.greenColor().CGColor;
progressCircle.fillColor …Run Code Online (Sandbox Code Playgroud) 使用图像制作长滚动视图时遇到问题.用户很难向下滚动这么长时间才能到达该图像或按钮.有没有什么方法可以在滚动视图的顶部创建一些按钮,同时按下这些按钮可以直接向下滚动到我想要的特定位置?(向下滚动动画会很好)
非常感谢.
我收到了错误
- [NSDictionary initWithObjects:forKeys:]:对象计数(0)与键计数(2)不同
这是我保存plist的代码.
@interface setting : UIViewController{
UIDatePicker *datePicker;
IBOutlet UILabel * morningtime;
UIDatePicker *afternoonpicker;
NSString*morningtime1;
NSString*afternoontime1;
IBOutlet UILabel *afternoontime;
}
@property (nonatomic,retain) IBOutlet UIDatePicker *datePicker;
@property (strong, nonatomic) IBOutlet UIDatePicker *afternoonpicker;
@property (nonatomic, retain) IBOutlet NSString *morningtime1;
@property (nonatomic, retain) IBOutlet NSString *afternoontime1;
@property (nonatomic, retain) IBOutlet UILabel *morningtime;
@property (nonatomic, retain) IBOutlet UILabel *afternoontime;
@property (weak, nonatomic) IBOutlet UIButton *morning;
- (IBAction)savetext:(id)sender {
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
// get documents path
NSString *documentsPath …Run Code Online (Sandbox Code Playgroud) 我正在按照教程进行溢出UICollectionView.此外,我想对物品进行选择,然后是新的外观UIViewController.
我可以知道如何做到这一点?我可以UITable选择选择索引= 0,1或2等吗?代码显示正确,NSLog但没有去其他UIViewController
- (void)tapCell:(UITapGestureRecognizer *)inGestureRecognizer
{
NSIndexPath *theIndexPath = [self.collectionView indexPathForCell:(UICollectionViewCell *)inGestureRecognizer.view];
if (theIndexPath.row ==0) {
NSLog(@"****");
page *noteDetailViewControler = [[page alloc] initWithNibName:@"page" bundle:nil]; }
}
Run Code Online (Sandbox Code Playgroud)
这是完整的代码:
@implementation CDemoCollectionViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.cellCount = 10;
self.imageCache = [[NSCache alloc] init];
[self.collectionView registerNib:[UINib nibWithNibName:NSStringFromClass([CCoverflowTitleView class]) bundle:NULL] forSupplementaryViewOfKind:@"title" withReuseIdentifier:@"title"];
NSMutableArray *theAssets = [NSMutableArray array];
NSURL *theURL = [[[NSBundle mainBundle] resourceURL] URLByAppendingPathComponent:@"Images"];
NSEnumerator *theEnumerator = [[NSFileManager defaultManager] enumeratorAtURL:theURL includingPropertiesForKeys:NULL options:NSDirectoryEnumerationSkipsPackageDescendants | …Run Code Online (Sandbox Code Playgroud) 我使用以下代码使用按钮初始化文本到语音合成.但有时用户可能希望在演讲中停止发声.我可以知道有没有我可以做的代码.
谢谢
这是我的代码
@interface RMDemoStepViewController ()
@end
@implementation RMDemoStepViewController
- (void)viewDidLoad
{
[super viewDidLoad];
//Add Border to TextBox
//Instantiate the object that will allow us to use text to speech
self.speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
[self.speechSynthesizer setDelegate:self];
}
- (IBAction)speakButtonWasPressed:(id)sender{
[self speakText:[self.textView text]];
}
- (void)speakText:(NSString *)toBeSpoken{
AVSpeechUtterance *utt = [AVSpeechUtterance speechUtteranceWithString:toBeSpoken];
utt.rate = [self.speedSlider value];
[self.speechSynthesizer speakUtterance:utt];
}
- (IBAction)speechSpeedShouldChange:(id)sender
{
UISlider *slider = (UISlider *)sender;
NSInteger val = lround(slider.value);
NSLog(@"%@",[NSString stringWithFormat:@"%ld",(long)val]);
}
@end
Run Code Online (Sandbox Code Playgroud) 我正在桌面视图上构建RSS提要.当我运行应用程序时,我的iPhone可以在ipad中顺利运行,它崩溃并显示"因未捕获的异常终止应用程序'NSInvalidUnarchiveOperationException',原因:'无法实例化名为UIRefreshControl的类'"
我试图在我的ipad模拟器上运行应用程序,它也可以顺利运行.我可以知道那是什么问题吗?
谢谢
我正在制作一个应用程序,并希望有一个链接到iOS 5的笔记应用程序的功能.是否有任何代码?例如,我有一个UIButton,当用户按下它时,它会关闭应用程序并启动iOS笔记应用程序.
谢谢
ios ×7
ipad ×4
iphone ×4
xcode ×4
objective-c ×3
animation ×1
ios6 ×1
ios7 ×1
nsdictionary ×1
plist ×1
progress ×1
swift ×1
uibutton ×1
uiimage ×1
uiscrollview ×1