I'm new to titanium and I,m trying to build some prototypes based on wireframes. Below is the wireframe that I'm trying to build as prototype.
What you see is a list of restaurants fetched from google places api. The main functionality here is the black strip which will be at a fixed position and holds the details of rating and reviews on a particular restaurant which is underneath it.
So if I scroll through the restaurants the black strip should get the rating details of that particular restaurant which is underneath it.
So far I was able to crawl the restaurants data from google places api into row of the table view.
I'm not sure what to call this functionality or how to achieve this.
Can you guys please give me direction to proceed ahead...
#Sarat,
I assume you wanted to develop this Prototype for iOS or Android App, so using Titanium I've below suggestion for design & functionality
To Achieve Design:
For Android - Use Relative Layout with List view which you can load Rating/Review Icons on top with Fixed Position
For iOS/iPhone - Add Parent VIEW and then Add Table VIEW to load Restaurant and Add Rating/Review Icons in Another Table VIEW with Same Top position of Restaurant List
To Achieve Functionality:
You will get First cell index of Table View in which Restaurant List you're loading, so keep check which Cell of Table is on Top of Table view using Cell Identifier.
Wouldn't it be much easier to just include it as a part of the row? Otherwise the user can only see one rows information at a time, which I would consider bad design.
More importantly, this will not work on iOS unless you add a lot of dummy table rows at the end of the TableView, since the user wont be able to scroll the bottom-most row to the top of the screen!
This tutorial shows you how to have custom table rows. Use it as a starting point to add your comment and like button images. I really see no other alternative, since your fixed position method requires hacking the TableView component or using transforms to move the bottom row to the top.
EDIT:
If you must do it this way, the best way forward would be to add a number of blank table rows to past the end of your real table rows so that the user can scroll all the way down to the last row with content (this way the fixed position can detect its over it).
Next create your view holding the three buttons, making sure its absolutely position in the window (so it stays fixed) and has a zIndex greater than the TableView:
var likeAndCommentHolderView = Ti.UI.createView({
top : 45,
left : 0,
//.... etc
zIndex : 101
});
window.add(likeCommentHolderView);
Now you have to figure out which row the user is over. This can be done using the scrollEnd event of a TableView and getting the contentOffset attribute of the event. The 'scrollEnd' event is triggered when the user has finished scrolling the rows in a tableView, it returns an event that has the contentOffset, which is just a measure of how much you have scrolled from the top of the tableView. Using simple math, calculate the offset divided by the rowHeight and that is the row index the user is looking at.
// Assume table view is at coordinates : top=45, left=0 and you have defined rowHeight
tableView.addEventListener('scrollEnd', function(e) {
// Use this to determine which row your over
var contentOffset = e.contentOffset;
// Figure out the index
var rowIndex = contentOffset / rowHeight;
// Get the row, assume first section
var section = tableView.data[0];
var rowObject = section.rows[rowIndex];
// Now update your UI with data from the row
var name = rowObject.restaurantName;
});
Now you have the actual row object in the table, you can extract
This is only a general outline, this does not take into account some of the differences between platforms, I leave that to you to figure out, but this is a good general approach.
Related
I have NSTableView in my application and i have added the hovering effect for the rows by using HoverTableDemo.
I can get the hovering effect only for one row in my table.
It is not apply for the whole table.
How can i get Hovering effect for full table.
Can any body have any idea please revert me.
Take a look: https://stackoverflow.com/a/464828/1758762
You're on the right track with -mouseEntered: and -mouseExited:.
Look into NSView's -addTrackingRect:owner:userData:assumeInside: and -removeTrackingRect: methods.
I can get the hovering effect only for one row in my table.
You can either set up your tableView to create trackingRects for every row that's in there whenever the contents of the tableView change, or alternatively, set up/update one tracking area on the entire tableView whenever -tile or another layout related method is called.
As you can see on the screenshot the segmented control is placed rather ugly this way.
I need it in that place, meaning below the section title and before the second cell for that section. How could I make this better?
I can think of two suggestions that would improve the appearance. The first would be to increase the height of the table cell (just that particular table cell, not all of the cells in your table) so that the whitespace margin at the top and bottom of your segmented control is equal to the margin you currently have on the left and right of the control.
Another solution would be to move the selection of the value for this setting into a separate tableView controller that you drill down to. So that cell would show the current value, but tapping the cell would take the user to a new view where the user could select to change the value.
Here is an example of this from the Instapaper app settings page that I think looks pretty clean.
Does the TableView Control in JavaFX 2 allow the insertion of new data right on the cells of the control?
I have not been able to find anything in that direction. Even the Oracle sample has separate textboxes and an ADD button outside of the control (like it was in the early 90's - yea, I've been programming for that long...)
It's not really clear what do you want to achieve.
If you mean editing table values in place you can take a look at this tutorial: http://docs.oracle.com/javafx/2.0/ui_controls/table-view.htm
If you want to add new row by action on cell you can add context menu to cells by TableView.setContextMenu(context_menu); and implement adding new row "right on the cells".
I have a table view in an iPhone xcode tab bar application that shows data either alphabetically or numerically, depending on a user selected option in one of the tabs. It works for the most part, but when I change the option and then go back into the table view, the table view initially looks like it did before the option was changed. However, as new cells get scrolled into view, they have the new display mode.
I can identify when the option changes, but I can't seem to get the code correct that would re-initialize the cells such that the next time they come into view they have the correct values. The data comes from a static array with set values, so I don't want to do anything with the data source, just the table view.
In other words, once the display option changes, I want to wipe out the table view I have so that the next time the table view displays it will show the correct data right from the start rather than after scrolling occurs.
Any help would be appreciated. Thanks.
It sounds like you want to call reloadData on the TableView.
[yourTableView reloadData];
I'm trying to build an app that will display stats for a certain game (I'd rather not say which one). I have most of the app completed, but I have run into a problem with my "Players" page, which is the primary view that loads after viewDidLoad. I've attached a screenshot of how it looks.
(DARN IT. I'm too new to post a pic. Available on request.)
It took some work, but I finally got my UIPickerView into place, and customized the initial options for it. You can't tell from the screenshot, but the picker loads with my player name, and one other. This will change before release.
My problem is that I want users to be able to enter their gamer name(s) in a text field, and have them always selectable from the picker after that. When they select a name in the picker, I need that action to send a string, a URL, with the player name appended to it, to every other view so that all navigation subsequent to choosing a player will show that player's data. This will allow me to load the rest of my server side graphics with ease.
Also, player names must be removable from the picker.
I'm not so lazy as to simply ask for the code, but I can't seem to figure out what components to use, or even find a tutorial that speaks to what I'm doing precisely.
OK what i understand is you want to do two operations on the picker value select.
send the url with the player name.
delete the player name..(if user wants).
Now for this you can add two buttons and as you know the value that are shown in the picker is basically you can store them in am array and load it again on picker.
so now you added two buttons one is for sending data and other is for delete.
on sendData button you can do like this to select the value from picker
NSInteger row;
NSArray *repeatPickerData;
UIPickerView *repeatPickerView; //this your picker, if you defined it already dont do it.
row = [repeatPickerView selectedRowInComponent:0];
self.strPrintRepeat = [repeatPickerData objectAtIndex:row];
now in the "strPrintRepeat" you have the selected value. you can do what ever you want with it.
and on deleting the player name..you can do something like this.
NSInteger row;
NSMutableArray *repeatPickerData; //this should be mutable
UIPickerView *repeatPickerView; //this your picker, if you defined it already dont do it.
row = [repeatPickerView selectedRowInComponent:0];
[repeatePickerData removeObjectAtIndex:row];
now at this point you have the player name removed.
Then you can use your UiPicker delegates to reload the picker with the updated data..
Hope that works..:) enjoy