TAIPEI — The Taiwanese company Elan Microelectronics has sued Apple, alleging infringement of two of its touch screen patents, an Elan spokesman said Wednesday.

The suit was filed Tuesday in U.S. District Court in San Francisco, Dennis Liu, an Elan spokesman, said by telephone from the headquarters of the chip design company in Hsinchu, Taiwan.

“We couldn’t find a common viewpoint with Apple, so we decided we had to take action,” he said, adding that the companies had been in licensing talks for about two years.

Apple is based in Cupertino, California.

The lawsuit alleges that Apple products — including its MacBook computer, iPhone and iPod Touch — use technology that infringes on two of Elan’s patents, Elan said.