如何通过Core Location框架获取当前位置或GPS坐标?
我有一些UIImageView数组,并希望循环它们来设置图像,但我不知道如何.
如果我有一个ImageView imgv,那么我这样做:
self.imgv.image =
Run Code Online (Sandbox Code Playgroud)
但是我如何在循环中使用许多UIImageViews呢?我做不到以下事情:
for(int i = 0; i < [imageViewArray count]; i++)
{
self.i.image =
}
Run Code Online (Sandbox Code Playgroud) 我对本地通知有这个问题,他们没有播放声音.我测试了默认的一个和自定义的那个显然是我想玩但没有!我看了很多人都面临这个问题,但他们的解决方案都没有对我有用.
UILocalNotification *local
- (IBAction)Dateaction:(id)sender {
local = [[UILocalNotification alloc]init];
local.timeZone = [NSTimeZone defaultTimeZone];
local.alertBody = [NSString stringWithFormat:@"%@ Recuerda que tienes que: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"user"], [[NSUserDefaults standardUserDefaults] objectForKey:@"selected"]];
local.fireDate = [self.DatePicker date];
/* if ([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]) {
local.soundName = @"sound1.caf";
}else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound2"]){
local.soundName = @"sound2.caf";
}else if([[self.userdefaults objectForKey:@"sound"]isEqualToString:@"sound1"]){
local.soundName = @"sound3.caf";
}else{
local.soundName = @"sound1.caf";
}*/
local.soundName = UILocalNotificationDefaultSoundName;
}
- (IBAction)switchChanged:(id)sender {
if(self.NotSwith.isOn == YES){
[[UIApplication sharedApplication] scheduleLocalNotification:local];
}
}
Run Code Online (Sandbox Code Playgroud) 我想在没有方法的同一个数组中找到一个元素的POSITIONS,一个算法......
示例:
var a = [1,2,2,1,4,5,6]
to display positions of 1 : position 0 and 3
to display positions of 2 : position 1 and 2
Run Code Online (Sandbox Code Playgroud)
到目前为止我做了什么:
function count(array,element){
while(element in array){
return array.indexOf(element);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用亚马逊网络服务。
我正在使用linux实例
我正在使用GoDaddy SSL。
我正在按照以下步骤操作:http : //jafty.com/blog/installing-godaddy-ssl-certificate-on-amazon-ec2/
我被困在这一点上:
生成证书签名请求(CSR)-Apache 2.x
我所做的是
openssl req -new -newkey rsa:2048 -nodes -keyout 180.21.80.1.key -out 180.21.80.1.csr
Run Code Online (Sandbox Code Playgroud)
我使用了t1实例的公共IP地址。我已经生成了密钥和CSR文件。
180.21.80.1。关键
180.21.80.1.csr
像这样。现在可以将其复制并粘贴到爸爸中。
我的问题是:
我想在上角用一个按钮制作一个tableview.我希望按钮再向表视图添加一行,以便您可以将图像添加到单元格或文本中.我在互联网上搜索但我没有找到答案.
这是源代码:
import UIKit
class TableViewController: UITableViewController {
var imageArray = ["1","2","3","4","5","6","7"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("Reccept") as UITableViewCell!
let imageView = cell.viewWithTag(2) as! UIImageView!
imageView.image = UIImage(named: imageArray[indexPath.row])
return cell
}
override func tableView(tableView: UITableView, numberOfRowsInSection …Run Code Online (Sandbox Code Playgroud) 我正在尝试配置一个单元格TableView.我要做的其中一件事是更改单元格中文本的字体和颜色.这是代码:
- (void)configureView {
UIFont *cellFont = [UIFont fontWithName:@"Raleway-Thin" size:14];
NSDictionary *cellAttributesDictionary = [NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: cellFont];
}
Run Code Online (Sandbox Code Playgroud)
NSFontAttributeName我收到错误后在冒号Expected ']'.导致此错误的原因是什么?
我正在摆弄制作一个cocoapod,我正在努力创建一个类来自类的子类Array.
我之所以将其归为子类Array,是因为Array并且NSArray在Swift中被区别对待.
我可以创建一个这样的类:
class Test : NSArray {}
Run Code Online (Sandbox Code Playgroud)
但如果我试试这个:
class Test : Array {}
Run Code Online (Sandbox Code Playgroud)
或这个:
class Test : [AnyObject] {}
Run Code Online (Sandbox Code Playgroud)
我收到一个错误.
我想要这个的原因主要是因为我可以使用这样的函数:
let i = myArray.randomObject()
Run Code Online (Sandbox Code Playgroud)
对此:
let i = Test.randomObject(myArray)
Run Code Online (Sandbox Code Playgroud)
我能做什么的想法(相反可能)?
我第一次下载了蒸汽,我得到了蒸汽4,不幸的是,我所有的教程都是建立在蒸汽3上的,如何降级蒸汽版本?
我有Iterator实例.我必须得到这个的大小.在这里,我得到了条目的大小.平均大小为8.假设我想在此迭代器中仅显示5个值.我该如何实现这一个?
Document<Feed> feeddoc = resp.getDocument();
List<Entry> entries = feeddoc.getRoot().getEntries();
entries = feeddoc.getRoot().getEntries();
Iterator<Entry> iterator = entries.iterator();
int size = entries.size(); //8
while (iterator.hasNext()) {
/* here I am getting 8 values means iterating 8 times but I want to iterate only 5 times */
Entry next = iterator.next();
userDetailsVos = new UserDetailsVos();
userDetailsVos.setTitle(next.getTitle());
final IRI temp = next.getLinkResolvedHref("alternate");
userDetailsVos.setUrl(temp.toString());
userDetailsVos.setTime(next.getContentElement().getFirstChild().getElements().get(5).getText());
System.out.println("(1)--" + next.getTitle());
System.out.println("(2)--" + next.getContentElement().getFirstChild().getElements().get(5).getText());
System.out.println("url: " + temp.toString());
}
Run Code Online (Sandbox Code Playgroud) 我是一名新的 Go 语言程序员。以下是我的程序,但我收到此错误:
#command-line-arguments
.\helloworld.go:20: undefined: json.Marshall
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么会收到错误?
package main
import (
"encoding/json"
"fmt"
"net/http"
)
type API struct {
Message string "json:message"
}
func main() {
http.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) {
message := API{"Hello, World!!!"}
output, err := json.Marshall(message)
if err != nil {
fmt.Println("Something went wrong")
}
fmt.Fprintf(w, string(output))
})
http.ListenAndServe(":8080", nil)
}
Run Code Online (Sandbox Code Playgroud) 有人能帮我把这段代码转换成 Swift 吗?
这里我提到了.h和.m在Objective-C 代码中。
Abc是一个UIViewController。我想在我的 Swift 代码中执行这个方法。S怎么可能?
Abc.h
+ (Abc*)sharedInstance;
- (void) startInView:(UIView *)view;
- (void) stop;
Run Code Online (Sandbox Code Playgroud)
Abc.m
static Abc*sharedInstance;
+ (Abc*)sharedInstance
{
@synchronized(self)
{
if (!sharedInstance)
{
sharedInstance = [[Abc alloc] init];
}
return sharedInstance;
}
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
@end
Run Code Online (Sandbox Code Playgroud) ios ×4
objective-c ×4
swift ×3
arrays ×2
swift2 ×2
algorithm ×1
amazon-ec2 ×1
audio ×1
class ×1
coordinates ×1
go ×1
inheritance ×1
iphone ×1
iterator ×1
java ×1
javascript ×1
list ×1
loops ×1
ssl ×1
uiimageview ×1
uitableview ×1
vapor ×1
xcode ×1
xcode7 ×1