QuickDialog - How do I select a QSelectItemElement= - ios

I am using QuickDialog in my app to present a search dialog to the user. The problem: I have to set some defaults in the controller which means toggle a QBooleanElement or - in this particular case - select a QSelectItemElement.
Is there any method to do that?
Furthermore: Is there any documentation for QuickDialog? I can't find any :(
Thanks in advance,
Christian

To set a QBooleanElement to a YES/NO value simply
QBooleanElement *qboolean = [[QBooleanElement alloc] initWithTitle:#"title" BoolValue:YES];
qboolean.key = #"booleanElementKey";
[firstSection addElement:qboolean];
If lately you need to set the value without interaction with the user, you do so by :
QBooleanElement* thisElement = (QBooleanElement*)[self.root elementWithKey:#"booleanElementKey"];
thisElement.boolValue = NO;
...
[self.quickDialogTableView reloadData];

To toggle the value in the QBooleanElement, you just need to set the property as necessary, and then call [quickdialogTableView reloadData], to refresh the table. You can also refresh cell by cell if you prefer.
Documentation for QD is still sparse, i have just started working on it. If you would like to contribute let me know! :)

Related

Change Table View Cell Color If message is New

I am new in iOS so please help me. I am getting some messages from server with a key "messageId". I am showing those messages in tableview. Now I have to differentiate that if there is new message which is being open first time in that tableview, I have to change the colour of that message in the cell.
cell.notificationMessageDate.text = [[self.notifications objectAtIndex:indexPath.row] valueForKey:#"msgCreatedDate"];
cell.notificationMessageText.text = [self stringByStrippingHTML:[[self.notifications objectAtIndex:indexPath.row] valueForKey:#"message"]];
NSString *str = [[self.notifications objectAtIndex:indexPath.row] valueForKey:#"messageId"];
self.isAlreadyExist = false;
if (str ) {
cell.backgroundColor = [UIColor whiteColor];
} else {
}
#AADi i see that you are getting message from notifications. I dont know what structure you have implemented.
To implement what you want, what i feel is you must implement a dictionary or array where you store your data from wherever you are fetching it. Then pass the count of the array or dict. to table. Now maintain a variable which stores the previous count of the array or dict. In cell for row, compare the index path with the previous count of the array or dict. If the index path is greater then previous count simply change the background for the cell at that index path and update the value of previous count with current count.
If you don't understand or have any doubts then ask here.
Hope it will help you.
A word of advice, its not a good approach to check if message is new locally. If a user uninstalls the app and reinstall it then all the messages would appear new to the user even thought she may have read them.
A better approach is to send boolean variable, something like seen or read, along with other details of message from the server and display the cells accordingly. To mark a message as read or seen you can make an API call to the server with the messageID reflecting it in the backend.

Unable to set CEMarker's collisionPriority

I'm trying to "mimic" the BusinessLayer functionality by creating a CEMarkerGroup for my own markers, then setting the following:
CEMarkerGroup *myGroup = [self.mapView markerGroupWithName:#"myMarkers"];
[myGroup setShouldTestForCollisions:YES];
And then, according to the Citymaps' current documentation, I try to set individual collisionPriority values to each like this:
[marker setCollisionPriority:25.0f]; //<-- ERROR!!, or
marker.collisionPriority = 25.0f; //<-- same ERROR
[myGroup addMarker:marker];
Error is: No visible #interface for 'CEMarker' declares the selector 'setCollisionPriority:'
As my goal is to approximate Citymaps' very slick behavior of avoiding marker overlaps, does anyone know of a workaround for this issue, or perhaps another approach altogether? Much thanks!
I am a developer at Citymaps. Thank you for your interest in our SDK!
Our documentation got a bit ahead of itself. Turns out, we never exposed the collisionPriority property. I've given myself a ticket to do so, and will let you know immediately when a new build is out containing this change.

iOS Autocomplete UITEXTVIEW | Add autocomplete suggestions dynamically

I've been trying to implement an autocomplete UITEXTVIEW for my email app using this
https://github.com/hoteltonight/HTAutocompleteTextField
I would like to add the email addresses dynamically though. Is there any way to achieve the same. Because when I checked, the email addresses are initialised at start as given below.
HTEmailAutocompleteTextField.m
- (void)setupAutocompleteTextField
{
[super setupAutocompleteTextField];
// Default email domains to suggest
self.emailDomains = #[ #"gmail.com", #"yahoo.com"];
self.autocompleteDataSource = self;
}
The above method is called from HTAutocompleteTextField.m[- (void)awakeFromNib] as soon as the app is launched thereby not letting me to add email addresses dynamically.
Is there any work around because I get my email addresses later.
Any help is much appreciated.
Have you tried this from GitHub readme
HTAutocompleteTextField *textField = [[HTAutocompleteTextField alloc] initWithFrame:CGRectMake(0,0,100,31)];
The data source is the brains of the autocomplete logic. If you just want to autocomplete email addresses, use HTAutocompleteManager from the example project as follows:
textField.autocompleteDataSource = [HTAutocompleteManager sharedManager];
textField.autocompleteType = HTAutocompleteTypeEmail;
Alternatively, you may wish to create your own data source class and user the autocompleteType property to differentiate between fields with different data types. A HTAutocompleteTextFields's data source must implement the following method, as part of the HTAutocompleteDataSource protocol.
-(NSString *)textField:(HTAutocompleteTextField *)textField completionForPrefix:(NSString *)prefix ignoreCase:(BOOL)ignoreCase

Thread 1 : EXC_BAD_ACCESS (Code = 1, address = 0x30000008)

I still stuck on this problem even followed all the answer from this forum. can anyone tell me what to do in simple way? I'm new learner in xcode. I have enable the zombie object.
this is my coding that got crash
if ([[[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:#"action"] isEqualToString:#"a1"]) {
NSString *t1 =[[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:#"title"];
NSString *a1 = [[AryStoreknowItem objectAtIndex:indexPath.row] objectForKey:#"action"];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// saving an NSString
[defaults setObject:a1 forKey:#"a1"];
[defaults setObject:t1 forKey:#"t1"];
JournalPage *journal=[[JournalPage alloc]initWithNibName:#"JournalPage" bundle:nil];
[self presentModalViewController:journal animated:YES];
In my Application, I have multiple ViewController. when i click on back button of UINavigationBar then this type of issue generated , i can't explain my problem because all the functionality work proper.
Example :-
1 - fitstVController (work properly)
=> it have UITableView , when i click on specific row then it will be go on another UIViewController (SecoundViewController)
2 - SecoundViewController (work properly)
=> it have UITableView and UIActionSheet. when i select button of UiActionSheet then another UIViewController (ThirdViewController) is open
3 - ThirdViewController (cannot open)
=> error came when i click on row three. same goes if i click on other cell, the third cell that i click will got crash before in goes to other pages
I don’t think we've got enough here to diagnose any particular problem (and it’s hard to follow your description). Nonetheless, I would recommend:
I would suggest running your code through the static analyzer (shift+command+B or “Analyze” on the Xcode “Product” menu) and making sure that doesn't provide any warnings. That will (amongst other things) identify many routine memory issues that can easily plague non-ARC code. There's no point in going further until you get a clean bill of health here.
I would suggest turning on the Exception Breakpoint and see if that identifies a particular line of code that is the source of the issue. Sometimes that can identify the line of code without having to reverse engineer where the error occurred by looking at the stack trace.
Given that you're doing non-ARC code, you might also want to temporarily turn on zombies. You can see this setting the the Scheme Configuration settings.
Beyond that, I’d refer you to Ray Wenderlich article My App Crashed, Now What?.
If you continue to have errors, share the stack trace with us.
You might have dismissed a ViewController while an object is still accessing it. That was my issue and reading Rob's answer helped.
This type of problem usually happens due to memory release/allocation
Go to
Product -> Clean
will fix this problem in most cases
I got this error when I was utilizing a reusable view /XIB and had the combination of two errors:
I forgot to specify the name of the custom class in the identity inspector
I cast the view as my specific view class in its outlet
Specifying the view class in the Identity Inspector corrected the error

UIAutomation with Instruments - How to tap copy/paste buttons?

I'm using Instruments for iOS automation and I can't seem to figure out how to tap options on the copy/paste menu. When I do a logElementTree(),I see that we are returning a UIEditingMenu and then three elements (which correspond to options of that menu, such as copy/paste, etc..). I am attempting to place this into a variable, and then trying to "tap" that variable but I cannot get that to work. Here is a sample of my code:
var target = UIATarget.localTarget();
var app = target.frontMostApp();
var window = app.mainWindow();
//This generates the highlighted text
app.dragInsideWithOptions({startOffset:{x:0.45, y:0.6}, endOffset:{x:0.45, y:0.6}, duration:1.5});
var copy = app.editingMenu.elements.withName("copyButton");
copy.tap();
Instruments returns, "0) UIAElementNil". In addition to the above, I've also tried:
app.elements.withName("copyButton")
window.elements.withName("copyButton")
So, I can get the editingMenu to produce the available options, but I cannot figure out a way to tap or select one of those options. I'm not quite sure I know how to reference those options to begin with.
Does anyone have any ideas?
Thanks!
You should try app.editingMenu().elements()[index].tap() where index is the index of the option you want to tap from the array of elements returned. I got my one working this way.
Hey.
First of all, I was always using .elements() not .elements... but it is JS, so it may be invoking function that is assigned to object property..?
Anyway, maybe this edit menu is not internal window of the app, but it is system level menu, that is invoked, when you do the drag? If that is true, try:
UIATarget.localTarget().frontMostApp().elements().withName("copyButton").tap();
But as I see in apple reference your version with calling app.editingMenu() should be fine...
Maybe try calling buttons by position, and you will see which respond:
UIATarget.localTarget().frontMostApp().editingMenu().elements()[0].tap;
UIATarget.localTarget().frontMostApp().editingMenu().elements()[1].tap;
UIATarget.localTarget().frontMostApp().editingMenu().elements()[2].tap;
You should find position of correct one this way. When you have it's position you can check its properties by button.logElement();. With this inf you you should be able to switch back to .withName method instead hardcoded position.
I did this similar to yoosiba but with editingMenu element names.
Using Xcode 4.5.1 and device running iOS 6.
Using Alex Vollmer's excellent tuneup_js for target, app and vtap().
Otherwise you can use UIATarget.localTarget().frontMostApp() and tap().
NOTE: vtap() will delay and retry tapping. Without this you may need to add your own delays.
// tap in textFieldA to see editingMenu.
app.mainWindow().textFields()["textFieldA"].vtap();
app.editingMenu().elements()["Select All"].vtap();
app.editingMenu().elements()["Copy"].vtap();
// must delay before attempting next tap
target.delay(2);
// ... navigate to different section of the app
// tap in textFieldB to see editingMenu.
app.mainWindow().textFields()["textFieldB"].vtap();
// paste clipboard contents copied from textFieldA into textFieldB
app.editingMenu().elements()["Paste"].vtap();
target.delay(2);

Resources