how to implement shutterstock tiker? - iphone

I have tried MKTikcerView , DMScrollingTicker and also made a Custom TickerView but , I am not satisfied with that all. All of them when comes to end string displays blank space.They are have not continuous objects displaying.I also use UITableView to show ticker objects by transforming it to horizontal.But there was also a problem that is some of the cells displaying blank.
The main objective is that , I want a ticker view like pull down shutterStock in iphone.It has continuous and updated objects and very smooth scrolling.
screenshot is given below:
Anyone help me please!
Thanks..!

I have add some improvement in my custom tickerView that displays view objects.Here is the files:
StockTicker.h and StockTicker.m .By using these files you can create continuous object displaying on tickerView and can update data easily.
You can use these files just like UITableView.It has its delegates to pass numberOfView to display on ticker and view that will display at particular index.
Using its delegates as:
#pragma mark- UITickerView delegate method
- (NSInteger)numberOfRowsintickerView:(StockTiker *)tickerView
{
return [objectArray count];
}
- (id)tickerView:(StockTiker*)tickerView cellForRowAtIndex:(int)index
{
return [objectArray objectAtIndex:index];
}
here objectArray is array of UILabels.
You can download SampleProject.

Related

Swipe Cell in UICollectionView - Swift

Is there an elegant and short way to progrematiclly swipe between two cells (assuming we have the desired NSIndexPath of the two cells)?
I see few possibilities here, having the information you provide.
1) You can use standard UICollectionView method: - moveItemAtIndexPath:toIndexPath:, but you must update your data source first. For example, assume you already updated data source (note that this example code is useless until you figure out index changes after moving items.):
collectionView.performBatchUpdates({ () -> Void in
collectionView.moveItemAtIndexPath(firstIndexPath,toIndexPath:secondIndexPath)
//note: proper indexes might be changed after moveItem.. method. Play with it and you'll find the proper one for your item.
collectionView.moveItemAtIndexPath(secondIndexPath,toIndexPath:firstIndexPath)
}, completion: { (finish) -> Void in
})
2) You can recalculate your layout if you use custom layout
3) You can just reload collection view with reloadData or reloadItemsAtIndexPaths E.g.:
var dataSourceArray = [1,2,3,4,5]
// some event occurred -> dataSourceArray changed
dataSourceArray = [1,2,5,4,3]
// call collectionView.reloadData() or reloadItemsAtIndexPaths(_:).
If you'll use 1st or 3rd way, in both cases data source must be up to date.

iPhone unit testing for viewController

I have a controller class in which i want to write the test case for the code which executed on the button click .In my testClass.m file i have following code from which i want to call the button from testClass.m . will this code work??
-(void)testcheckTheArrayForNull
{
viewController.temp=#"c";
viewController.buttonCount=1;
[viewController goButton:self];
STAssertNotNil(viewController.setUpArray,#"set up Array is not nil");
}
By this code will my control transfer to goButton???
I would say this could work, but you didn't provide code for goButton, setUpArray and I have no idea what temp or buttonCount do - so just guessing.

Has anyone used MT.D MultilineEntryElement?

I'm using the most recent one created by Alxandr (Feb/2012).
I'm trying to add it to a section using the same technique as I would adding an EntryElement. The MultilineEntryElement adds to the section but the receiving cell will not expand past it's default size. The MLEE will then overwrite the section below. I would like it to default to full screen width and 10 lines long. What is the best way to do this?
Thanks you!
Matt
To deal with this problem, set the RootElement's UnevenRows property to true, like this:
var r = new RootElement ("foo") { ... }
r.UnevenRows = true;
I did a bit more research on this issue. Please note - I am using my own implementation of MultilineEntryElement which is probably a bit different than others'.
First, it's worth stating that the issue does not manifest for me in "simple" scenarios - where a MultilineEntryElement is placed inside a section which is created as part of the initial creation of the RootElement. The issue only manifests when I manipulate an existing RootElement that has already been rendered by the DialogViewController.
It appears that there is a bug in the way MonoTouch.Dialog computes sizing of rows. If an element implements IElementSizing, then MT.D will call its GetHeight() overload. Once MT.D has detected an element with "irregular" height, it appears to need to call this method every time it processes a change to the enclosing section. This can be expensive... So if MT.D lays out a RootElement and hasn't found an element that implements IElementSizing, it appears that (perhaps intended as an optimization?) MT.D will IGNORE IElementSizing information for any elements that are added POST initial rendering. So the CELL's RowHeight property will return a standard row height, and the MultilineEntryElement will render a UITextView that spills over the cells below it.
The workaround I've come up with is to create a simple element called DummyElement which implements IElementSizing and returns 0 for GetHeight(), and to add it to the initial RootElement before the initial layout happens. If you do that, MT.D will register that there's an element which has an irregular height, and call the GetHeight() method on your MultilineEntryElement when you later add it to your element "DOM".
Here is my minimal impl of DummyElement in case it helps:
public class DummyElement : Element, IElementSizing
{
public DummyElement() : base ("empty")
{
}
public float GetHeight (UITableView tableView, NSIndexPath indexPath)
{
return 0;
}
}

Enumeration in iphone is not working

i am developing an iphone application in which i have 3 classes => main class , abc class, pqr class. On main view , i have imageview on which i am displaying image. when user touch at the center of image on main view , new view will be pushed (depending on condition mentioned below)
a) if user came from abc view then
new view will not be pushed
b) if user came from pqr view then i
have to push new view .
My problem is how can i detect from which view user came to main view.
I create 1 class in which i have following code in .h file
typedef enum {
abcViewSelected,
pqrViewSelected
} SelectedViewType;
#interface Enumeration : NSObject {
SelectedViewType selectedViewType;
}
#property(nonatomic) SelectedViewType selectedViewType;
In . m file i have
#synthesize selectedViewType;
When user select table cell from abcView & pqrView , i am pushing main view & setting view type in didSelectRowAtIndexPath as follows :-
enumObj.selectedViewType = abcViewSelected;
enumObj.selectedViewType = pqrViewSelected;
In main view's touchBegan method i am compairing which view is selected by writing this
if(enum.selectedViewType == pqrViewSelected) => push new view
else do nothing.
But this is not compairing & in none of case new view is pushed. I have imported all the required header files everywhere.
Plz help me ....Thanks in advance.
The problem must be in this line:
if(enum.selectedViewType = pqrViewSelected)
Here you do not compare current type value, but rather assign pqrViewSelected to it (you have '=' instead of '=='). Try changing that line to:
if(pqrViewSelected == enum.selectedViewType){
// push view
}
Note that having constant expression as first parameter in comparison makes it impossible to mistakingly use assignment ('=') instead of comparison ('==').

Custom iPad keyboard that looks like the system keyboards

I'm looking for a non-hackish solution for this, so basically -inputView. The part that I'm not sure about is how to make it look like the regular keyboards, from the background to the keys. I realize that I could photoshop an apple keyboard, but this seems like it is a little hackish, especially if apple (probably not but still possible) decides to change the look of their keyboards. I know Numbers has done an excellent job of making extra keyboards that look like the standard system ones, and I would like to do it like those (although obviously they have access to the same resources that made the system keyboards, including possible private frameworks, etc.)
I used the following:
tenDigitKeyboard.m
-(IBAction)pressedKey:(UIButton *)sender
{
[delegate pressedKey:sender.tag];
}
where delegate is defined as `id delegate;
then in the delegate i do...
-(void)pressedKey:(NSInteger)key
{
NSString * bufferString = model.string;
if (key == -1) {//delete
model.string = [bufferString substringWithRange:NSMakeRange(0, [bufferString length]-1)];
}else{
//will need to change the following to lookup key value based on a lookup of the button.tag
model.string = [bufferString stringByAppendingFormat:#"%i",key];
}
[self update];//updates the view
}
I got the keyboard button artwork from: http://www.teehanlax.com/blog/iphone-gui-psd-v4/
Create a view controller and xib. The xib should have 1-9,0 and delete buttons mapped to IBOutlets in your controller. Store and retain the return value string as a property. You can add decimals, etc. if you wish. In the header, store an edition block closure with a property (or alternatively create a delegate or use notification).
#property (copy) void(^valueChangedBlock)(NSString* string);
On touch up, each button sends an event to a method like this:
- (IBAction) pressKey:(id)sender
{
NSString *toAppend;
// Instead of this switch you can store the values in a dictionary mapped by sender.
switch(sender)
{
case oneButton: toAppend=#"1"; break;
case twoButton: toAppend=#"2"; break;
...
}
returnValue = [returnValue appendString:toAppend];
valueChanged(returnValue);
}
Obviously the delete key should remove a character from the end of the string instead of appending. Other than creating the controller and adding this view as the inputView, you should add the valueChangedBlock and set it to update the text field. You may want to put a clear custom button over the text field set to make the field first responder so it doesn't appear as if the user can edit at any point in the string.