Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new to Parse.
I am using Parse in my app. I have a class which stores scores of users. Now, I want to get Top 10 maximum scorer. How can I?
Please Help!
Down Voters Please answer!
It's really not so hard, just take a look at the docs.
But, anyway, you should probably do something like this:
PFQuery *query = [PFQuery queryWithClassName:#"Player"];
[query orderByDescending:#"score"];
query.limit = 10;
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
if (!error) {
} else {
}
}];
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I'm making a math game. Every time I click a button a new question should appear with different results to choose from.
However every time I click the button which I think is the result it doesn't update the text but the others do.
See github: https://github.com/Combii/BrainTrainerSwift
Use UIButton.setTitle(, for:) method. I suggest you to change code in ViewController.swift:
func setNumbers(numberDic: Dictionary<String, Int>) {
let btns = [bt1, bt2, bt3, bt4]
UIView.performWithoutAnimation {
for (position, number) in numberDic {
btns[(Int(position) ?? 0) - 1]?.setTitle(String(number), for: .normal)
}
}
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a problem with youtube duration.
How to separate this string:
PT1H50M20S
to 1:50:20 with NSRegularExpression.
No need to use NSRegularExpression here, you can use NSCharacterSet instead.
let s = "PT1H50M20S"
s.componentsSeparatedByCharactersInSet(NSCharacterSet.letterCharacterSet())
.filter { $0 != "" }
.joinWithSeparator(":") // 1:50:20
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
how to read data from QML page using signals
how to wite received data in another QML page using signals
i excatly expect qtsignals and slots concepts. please anybody tell how to read and wrote data from qml page.
Try the following syntax and get sample from github
1.HPP FILE
Q_PROPERTY(QString companyname READ companyname WRITE setcompanyname NOTIFY companynameChanged)
void companynameChanged();
void setcompanyname(const QString &company);
QString companyname() const;
QString m_company;
2.CPP FILE
void ApplicationUI::setcompanyname(const QString &company)
{
if (m_company == company)
return;
m_company = company;
emit companynameChanged();
}
QString ApplicationUI::companyname() const
{
return m_company;
}
------------------- Get sample full code from here (CLICK HERE)-----------
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Very strange issue.
I have the following code:
NSDictionary* notificationUserInfo = [pNotification userInfo];
NSManagedObject* newShoppingFilter = [notificationUserInfo valueForKey:#"shoppingListFilter"];
self.shoppingListFilter = newShoppingFilter;
NSLog(#"%# tapped", [newShoppingFilter valueForKey:#"name"]);
For some reason the self.shoppingListFilter = newShoppingFilter is not setting the variable.
I assume that this is some issue with not initializing the self.shoppingListFilter variable in some way but I cannot figure this out. The NSLog shows the right output, newShoppingFilter is not null but self.shoppingListFilter is.
Any help is appreciated.
I bet newShoppingFilter is nil. Most likely, there is no key "shoppingListFilter" in the notification user info dictionary.
Set a breakpoint at the line that assigns a value to self.shoppingListFilter and check the value of newShoppingFilter. Also display the entire contents of notificationUserInfo.
Post the code that creates the user info dictionary and passes it into the notification that you are posting. That would help track down the problem.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
i need to build an iPhone app that's search in Sqlite Database by using search bar and display the result in UITableView , could any one give me tutorial or source code to trace them , Thanks in advance,
Regards
For searching using SQL query, refer the LIKE operator: http://www.sqlite.org/lang_expr.html
The query normally comes out to be something like this:
NSString *nsquery = [[NSString alloc] initWithFormat:#"SELECT * FROM RECIPE WHERE RECIPENAME LIKE '%#'", someRecipeName];
For SQLite: here is tutorial for quick learning
http:// www.techotopia.com/index.php/An_Example_SQLite_based_iOS_4_iPhone_Application_(Xcode_4)
if you want exact string Match
NSString *querySQL = [NSString stringWithFormat:
#"SELECT address, phone FROM contacts WHERE name=\"%#\"",
name.text];
if you want to match string as substring
NSString *querySQL = [NSString initWithFormat:#"SELECT address, phone FROM contacts WHERE name LIKE '%#'",someName];
Here is more example of how to use Like
/* Returns all users whose name starts with "d" */
SELECT * FROM contacts WHERE name LIKE 'd%'
/* Returns all users whose name contains "dav" */
SELECT * FROM contacts WHERE name LIKE '%dav%'
Hope this will help you